Skip to content

Latest commit

 

History

History
27 lines (25 loc) · 1.04 KB

README.org

File metadata and controls

27 lines (25 loc) · 1.04 KB

APL

Use APL operations in Haskell: Strongly Typed APL operations on top of Haskell QuasiQuotes.

Design

Parser

Syntax

SyntaxMean
1,2,3,4,51d Int Array
.op aMonadicOp on a
a .op bDyadicOp on a & b
.op/ aReduce a with op
a (op.) bOuter product of a and b
a (op1.op2) bInner product of a and b

Use of comma allows parser to differentiate + 1 2 3 - 3 4 5 and + 1 2 3 (- 3 4 5)

Example

Conway’s Game of Life implemented in Haskell APL EDSL:

[apl|1,# (or.and) 3,4 .eq .plus/ .plus/ 1,0,-1 (rotateFirst.) 1,0,-1 (rotate.) .enclose #|]

It is almost one to one equivalent to APL counter part: {1 ⍵ ∨.∧ 3 4=+/+/¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

Possibilities

  • [ ] Offload array computation to Accelerate
    • Is this even possible?