DYNA25: Spring Edition is taking place on 7 April in New York City. More info

Towards Improvements to Stencil

Background The stencil operator ⌺ was introduced in Dyalog version 16.0 in 2017. Recently we received some feedback (OK, complaints) that (a) stencil does padding which is unwanted sometimes and needs to be removed from the result and (b) stencil is too slow when it is not supported by special code. First, stencil in cases […]

Ascending and Descending

Lexicographic Ordering Lexicographic ordering is what the APL primitives ⍋ and ⍒ provide: ⎕io←0 ⍝ ⎕io delenda est ⎕rl←7*5 ⍝ to get reproducible random results a←?11 3⍴3 a a ⌷⍨⊂ ⍋a 2 1 0 0 1 0 0 2 2 0 2 2 1 1 1 1 0 0 1 0 0 1 0 1 […]

Krypto

In the 2016 Year Game, the task was to generate the numbers 0 to 100 using APL primitives and the digits 2 0 1 6 in that order. For example, 20=16 ×2016 2⌊016 2+×016 … This “puzzle of the year” brings to mind Krypto, a game I played many years ago while in grade school. […]

Beauty and the Beast

Finally, the last accessory I ordered for my Raspberry Pi Zero (that’s the little red thing behind my keyboard) has arrived – an Acer 43″ ET430K monitor. The Zero won’t quite drive this monitor at its maximum resolution of 3840×2160 pixels, but as you can see, you get enough real estate to do real graphics […]

Charting Reaction Times on the Raspberry Pi

Earlier this week I collected some reaction timer data on my Pi using the BBC micro:bit as an input device. I only produced an “ASCII art” chart at the time:       times←ReactionTimer.Play times 251 305 294 415 338 298 294 251 378 ReactionTimer.AsciiChart times 425| 400| * 375| * 350+ 325| * 300| […]

APL Exercises

These exercises are designed to introduce APL to a high school senior adept in mathematics. The entire set of APL Exercises has the following sections: Introduction 0. Beginnings 1. Utilities 2. Recursion 3. Proofs 4. Rank Operator 5. Index-Of 6. Key Operator 7. Indexing 8. Grade and Sort 9. Power Operator 10. Arithmetic 11. Combinatorial […]

50847534

⎕io←0 throughout. I was re-reading A Mathematician’s Apology before recommending it to Suki Tekverk, our summer intern, and came across a statement that the number of primes less than 1e9 is 50847478 (§14, page 23). The function pco from the dfns workspace does computations on primes; ¯1 pco n is the number of primes less […]

Shuffle Faster Please!

Andy reported that in the shuffle QA some functions take a long time: m9249   “4½ days so far” rankop  21.5 hours m12466  26.3 hours points  7.2 hours Background: Shuffle QA is an intensification of the normal QA. The suite of over 1800 QA functions is run under shuffle, whereby every getspace (memory allocation) is followed by every APL array […]

The Halting Problem Rendered in APL

The halting problem is the problem of determining, from a description of a program and an input, whether the program will finish running or continue to run forever. It was proved in the negative by Alonzo Church and Alan Turing in 1936, and can be rendered in Dyalog APL as follows: Suppose there is an […]

Quicksort in APL Revisited

A message in the Forum inquired on sorting strings in APL with a custom comparison function. First, sorting strings without a custom comparison function obtains with a terse expression: {⍵[⍋↑⍵]} ‘syzygy’ ‘boustrophedon’ ‘kakistocracy’ ‘chthonic’ ┌─────────────┬────────┬────────────┬──────┐ │boustrophedon│chthonic│kakistocracy│syzygy│ └─────────────┴────────┴────────────┴──────┘ Sorting strings with a custom comparison function can also be accomplished succinctly by simple modifications to the Quicksort […]

Permutations

I started composing a set of APL exercises in response to a query from a new APL enthusiast who attended Morten’s presentation at Functional Conf, Bangalore, October 2014. The first set of exercise are at a low level of difficulty, followed by another set at an intermediate level. One of the intermediate exercises is: Permutations […]

In Praise of Magic Functions: Part II

Part I of this post was concerned with the development speed and execution speed of magic functions and should be read before this post. Benefitting from Future and Past Improvements Looking at the magic function for key in Part I, we see that its performance depends on the following APL primitives, listed with information on […]

In Praise of Magic Functions: Part I

A magic function is an APL-coded (dfn) computation in the C source of the interpreter. For example, some cases of ∧.= are coded as MAGIC(“(≢⍺)(↑∘.=↓)⍺⍳⍺⍪⍉⍵”). The rubric “magic function” includes magic functions and magic operators. Acknowledgments. Magic functions in Dyalog are made possible due to work done by John Scholes and Richard Smith. Development Speed […]

Changes of Heart

Karen Shaw started the ball rolling (hearts afluttering?) by asking Jay Foad to come up with a one-liner for St. Valentine’s Day; he then solicited contributions from the language development group. Nick Nickolov responded with the following, with no explanation other than that there is room for improvement: ⎕io←0 ⋄ (⊢,⌽)’ X'[{(.5×n*2)>+/(⍺-.6×⍵)⍵*2}/¨0↓n-⍳(2×n),n←20] XXXXX XXXXX XXXXXXXXXX […]

Solving the 2014 APL Problem Solving Competition – Cryptography Problem 3

This post is the continuation of the series where we examine some of the problems selected for the 2014 APL Problem Solving Competition. In this post we’ll conclude looking at the cryptography problems from Phase II that we started looking at in a previous blog post and continued in a further blog post. Cryptography Problem […]

Solving the 2014 APL Problem Solving Competition – Cryptography Problem 2

This post is the continuation of the series where we examine some of the problems selected for the 2014 APL Problem Solving Competition. In this post we’ll continue looking at the cryptography problems from Phase II that we started looking at in a previous blog post. Cryptography Problem 2 – Book Cipher Variation Task 1 […]

Solving the 2014 APL Problem Solving Competition – Cryptography Problem 1

This post is a continuation of the series where we examine some of the problems selected for the 2014 APL Problem Solving Competition. I’ll start by looking at the cryptography problems from Phase II. Cryptography Problem 1 – Vigenère Cipher The cipher is described using a large table of letters, but you don’t need to […]

The Diamond Kata

Acknowledgments Morten Kromberg is the other co-author of this text but the blogging software prevents his being listed as such. We are indebted to Jay Foad, Nick Nikolov, John Scholes, and Fiona Smith for comments on successive drafts of the MS. The Problem The diamond kata is a programming exercise used in the agile development, […]

Three-and-a-bit

The most obvious expression for computing π in APL is ○1. But what if you can’t remember how ○ works, or your O key is broken, or you feel like taking the road less travelled? With thanks to Wikipedia’s excellent list of Approximations of π, here are some short sweet APL expressions for three-and-a-bit: 3 ⍝ very short […]

Solving the 2014 APL Problem Solving Competition – it's as easy as 1 1 2 3…

The winners of the 2014 APL Problem Solving Competition were recognized at the Dyalog ’14 user meeting and had a chance to share their competition experiences. Emil Bremer Orloff won the student competition and received $2500 USD and an expenses-paid trip to Dyalog ’14, while Iryna Pashenkovska took first place among the non-student entries and received a complimentary […]

Why Dyalog '14 was a Shear Delight

Recent versions of Microsoft Windows support touch screens, which of course means that applications can respond to events originating from touches. Microsoft calls these events “gestures”. Dyalog decided to add support for gestures to version 14.1 and so projects were planned, designs were designed, code was coded and, at Dyalog ’14 (#Dyalog14), a demonstration was […]

Turning to a Heading with an MPU-9150

As the odour of fried electronics dissipates in the air, I’m unexpectedly afforded the opportunity to write this blog post a day or two earlier than planned. The on-board compass was exhibiting significant deviation, so I consulted my nephew Thorbjørn Christensen at DTU-Space. Thorbjørn makes a living designing magnetometers for space agencies around the world, […]

Dancing with the Bots

Last week the ‘bots were busy preparing for the J Language Conference in Toronto, where they made their first public appearance together. Upon returning to Bramley they continued training and we are proud to present the first recording of their new dance: [embedplusvideo height=”400″ width=”584″ editlink=”http://bit.ly/1u6Knob” standard=”http://www.youtube.com/v/oO50UqFBsCw?fs=1&vq=hd720″ vars=”ytid=oO50UqFBsCw&width=584&height=400&start=&stop=&rs=w&hd=1&autoplay=0&react=1&chapters=&notes=” id=”ep3993″ /] The ‘bots are both running […]

Aligning Diff Output

‘Bots are off limits this week so here is a story from this year’s Iverson College – a fantastic week spent in the company of a wonderful mixture of array and functional language gurus and newbies, all learning from each other. One evening, Dhru Patel presented a problem that he was working on which involved […]

Get Support

Technical advice and assistance on all aspects of Dyalog usage is available by e-mail (support@dyalog.com) and/or telephone (+44 1256 830030 – limited to U.K. office hours). Limited advice on design and coding is available, but is not intended to replace the use of the printed and on-line documentation. Except when reporting an issue with the software, users are encouraged to seek advice from the user community via the Dyalog Forum (reading the content of the forums does not require membership).

Search our website...