APL.jl

Author shashi
Popularity
23 Stars
Updated Last
6 Months Ago
Started In
September 2015

APL

Demo notebook

Video: APL at Julia's Speed (JuliaCon 2016)

Implementation notes

Here's the implementation explained in brief.

The apl"" string macro parses and evals an APL expression. The parser works on the reverse of the string, and consists of a bunch of concatenation rules defined as a generic cons function.

APL strings are parsed and executed to produce either a result or an object representing the APL expression. Primitve functions are of the type PrimFn{c} where c is the character; similarly, operators are of type Op1{c, F} and Op2{c, F1, F2}, where F, F1 and F2 are types of the operand functions — these type parameters let you specialize how these objects are handled all over the place. An optimization is simply a method defined on an expression of a specific type.

The call generic function can be used to make these objects callable! The eval-apply is really simple and quite elegant.