Diane's Lasagne Problem
Making Lasagne Participants in the SA2 Performance Tuning workshop at the Dyalog ’18 User Meeting were encouraged to bring their own problems for the group to work on. Diane Hymas of ExxonMobil brought a good one. The one-liner computation is as follows: lasagne0 ← {groups {+⌿⍵}⌸ amts ×[⎕io] spices[inds;]} where n ← 8e5 spices ← […]
Permuting Internal Letters
Friday Afternoon It’s something of a custom in Dyalog to send a “fun” e-mail to the group on Friday afternoons. My gambit for this past Friday was: x ←’ according to research it doesn”t matter’ x,←’ what order the letters in a word are’ x,←’ the human mind can still read it’ x,←’ the only […]
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 […]
Constructions
Suki Tekverk, a summer intern, spent the last two weeks here studying APL. She will be a high school senior next September and is adept in math, so in addition to APL we also considered some math problems, proofs, and proof techniques, including the following: Given line segments x and y, construct (using compass and […]
The Story of a Summer Intern
by Suki Tekverk As a born and raised New Yorker, I thought I had seen it all, but two short weeks spent in Vancouver with Roger Hui and his family proved me very wrong! I went from being at the top of the totem pole to one of the most clueless people around. Luckily, these […]
Loops, Folds and Tuples
For-loops Given an initial state defined by a number of variables, a for-loop iterates through its argument array modifying the state. A←… ⋄ B←… ⋄ C←… ⍝ initial state :For item :In items ⍝ iterating through array “items” A←A … item ⍝ new value for A depending on item C←C … A … item ⍝ new value for C depending on A and item … ⍝ state updated :EndFor A B C ⍝ […]
Type Comments
I’ve taken to commenting the closing brace of my inner dfns with a home-grown type notation pinched from the Functional Programming community: dref←{ ⍝ Value for name ⍵ in dictionary ⍺ names values←⍺ ⍝ dictionary pair (names⍳⊂⍵)⊃values ⍝ value corresponding to name ⍵ } ⍝ :: Value ← Dict ∇ Name I keep changing my […]
Response to Name Colouring for Dfns
This post contains comments to John Scholes’ post on name colouring; please continue to post any further comments with the original post. This is a very interesting topic – as the discussion has already showed, there are many different needs. It seems to me that some of the suggestions that have been made are forms of highlighting […]
Name Colouring for Dfns
APL is sometimes criticised because expressions that include names cannot, in general, be parsed without knowing whether the names represent functions or variables. For example, the name thing in the expression thing⍳3 could reference an array (in which case the ⍳ is dyadic) or it could reference a function (making the ⍳ monadic). An APL […]
Do Functions Know Their Own Names?
Going back a long way when John Scholes and I were writing version 0 of Dyalog there was a big discussion about whether functions knew their own names. This discussion still surfaces, with John taking the side that they don’t and me taking the side that they do. Essentially, John would argue that after A←2, […]
Unforgettable Numbers
Professor Kip Murray asked on the J Forum for the “unforgettable” times seen on a 24-hour digital clock. The problem is that every number has something notable about it, so that each number is “unforgettable” and consequently it’s hard to remember any single one of them. 0000 all zeros 0001 first counting number 0002 first […]
Foo, Shmoo
“We do not realize what tremendous power the structure of an habitual language has. It is not an exaggeration to say that it enslaves us through the mechanism of s[emantic] r[eactions] and that the structure which a language exhibits, and impresses upon us unconsciously, is automatically projected upon the world around us.” —Korzybski (1930) in […]
What's Your Favourite Beautiful Squiggle?
Roger’s post speculating on Ken Iverson’s favourite APL expression reminded me that one of the delegates at Dyalog ’14 conducted a quick survey to find the most popular primitive (thanks to Alex Weiner for taking the initiative here!). His findings are reproduced below: 9 votes: ⍴ 8 votes: ⍳ 6 votes: ⍨ 4 votes: ⍠ […]
Ken Iverson's Favourite APL Expression?
What was Ken Iverson’s favourite APL expression? I don’t know that he had one and if he had I don’t know what it was, but if I have to guess … From Sixteen APL Amuse-Bouches: The expression (0,x)+(x,0) or its commute, which generates the next set of binomial coefficients, is present in the document that […]
Musings on Reduction
In one man’s humble opinion, reduction (⌿) is the Queen of Operators. Each (¨) comes a close second, but doesn’t get the cigar because each can be written in terms of reduction. Two special cases are of interest: reduction along axes of length 1 (or reduction of a scalar) and reduction along axes of length […]