Skip to content

SeungheonOh/APL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks