Skip to content

RubenVerg/tinyapl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyAPL

TinyAPL logo

TinyAPL (read like tiny apple) is a tiny APL dialect and interpreter in Haskell. It is being implemented as a series of articles available here.

Features

Marked features are supported, unmarked features are planned

  • Types
    • Arrays
      • complex numbers
      • unicode characters
      • boxes (nested arrays)
    • Functions
    • Monadic Operators ("Adverbs")
    • Dyadic Operators ("Conjunctions")
  • Syntax
    • number literals
      • decimal point .
      • negative sign ¯
      • exponent notation
      • complex notation
      • complex phase notation?
      • infinities
    • character literals '
    • string literals "
      • escapes with
        • ⍘⍘ ->
        • ⍘" -> "
        • ⍘n -> newline
        • ⍘r -> carriage return
        • ⍘t -> tab
        • ⍘{22be} -> unicode?
    • names
      • array names (abc)
      • function names (Abc)
      • monadic operator names (_Abc)
      • dyadic operator names (_Abc_)
    • assignment
    • dfns/dops
      • multiple statements
      • guards :
      • early return
      • dfns {...}, dadvs _{...}, dconjs _{...}_
      • refer to arguments and operands: left argument, right argument, ⍺⍺ left array operand, ⍶⍶ left function operand, ⍵⍵ right array operand, ⍹⍹ right function operand
      • recursion: recurse function, _∇ recurse adverb, _∇_ recurse conjunction
    • comments
      • inline comments? /
    • console I/O with and
    • array notation // and [//]
  • primitives
    • arrays
    • number functions
      • + conjugate
      • + add
      • - negate
      • - subtract
      • × direction
      • × multiply
      • ÷ reciprocal
      • ÷ divide
        • 0÷0 is 1
        • x÷0 is an error
      • * exponential
      • * power
      • ln
      • log
        • 1⍟1 is 1
        • 1⍟y is an error
        • x⍟0 is an error
      • pi times
      • circular
        • 0○y is $\sqrt{1 - y^2}$
        • 1○y is $\sin y$
        • ¯1○y is $\arcsin y$
        • 2○y is $\cos y$
        • ¯2○y is $\arccos y$
        • 3○y is $\tan y$
        • ¯3○y is $\arctan y$
        • 4○y is $\sqrt{1 + y^2}$
        • ¯4○y is $\sqrt{y^2 - 1}$
        • 5○y is $\sinh y$
        • ¯5○y is $\mathop{\text{arsinh}} y$
        • 6○y is $\cosh y$
        • ¯6○y is $\mathop{\text{arcosh}} y$
        • 7○y is $\tanh y$
        • ¯7○y is $\mathop{\text{artanh}} y$
        • 8○y is $\sqrt{-1 - y^2}$
        • ¯8○y is $-\sqrt{-1 - y^2}$
        • 9○y is $\mathop{\text{Re}} y$
        • ¯9○y is $y$
        • 10○y is $\left|y\right|$
        • ¯10○y is $\overline y$ (conjugate of $y$)
        • 11○y is $\mathop{\text{Im}} y$
        • ¯11○y is $iy$
        • 12○y is $\mathop{\text{Arg}} y$
        • ¯12○y is $e^{iy}$
      • square root
      • root
      • floor
      • minimum
      • ceiling
      • maximum
      • round
      • average?
      • matrix inverse
      • matrix divide
      • ! factorial/gamma
      • ! binomial
      • | magnitude
      • | remainder
      • greatest common divisor
      • least common multiple
      • cartesian (x⊕y is $x + iy$)
      • pure imaginary (⊕y is $iy$)
      • polar (x⊗y is $xe^{iy}$)
      • unit polar (⊗y is $e^{iy}$)
      • phase
      • set phase ((|y)⊗x)
      • real part
      • set real part
      • imaginary part
      • set imaginary part
      • decode
      • base 2 decode
      • encode
      • base 2 encode
    • boolean functions
      • = equals
      • not equals
      • < less
      • less or equal
      • greater or equal
      • > greater
      • match
      • not match
      • and
      • or
      • nand
      • nor
      • ~ not
    • set functions
      • unique
      • union
      • intersection
      • ~ difference
      • § symmetric difference
      • nub sieve
      • multisets?
    • property functions
      • index of
      • interval index
      • element of
      • find
      • type? depends on if prototypes are added or not
      • depth
      • shape
      • tally
      • ϼ rank
    • array creation functions
      • index generator
      • ? roll
      • ? deal
      • range?
      • pair
      • half pair
    • array manipulation functions
      • take
      • drop
      • prefixes (mix is ⊃⍤0)
      • suffixes (split is ⊂⍤1)
      • enclose
      • nest
      • partitioned enclose
      • partition
      • grade up
      • grade down
      • sort by up?
      • sort by down?
      • sort up? useless with sort by (⍋⍨)
      • sort down? as above
      • where
      • enlist
      • replicate
      • expand? (might not make much sense without prototypes)
      • / replicate last
      • \ expand last?
      • , ravel
      • table
      • catenate
      • , catenate last
      • reshape
      • ϼ rerank (generalized version of promote/demote: introduce leading length-1 axes or combine leading axes)
      • reverse
      • rotate
      • reverse last
      • rotate last
      • transpose
      • reorder axes
    • array lookup functions
      • first
      • last
      • from
      • index
      • pick
    • misc functions
      • / same
      • right
      • left
      • execute
      • format
      • raise?
    • operators
      • reduce top-to-bottom (first)
      • windowed reduce top-to-bottom (first)
      • reduce bottom-to-top (first)
      • windowed reduce bottom-to-top (first)
      • reduce left-to-right (last)
      • windowed reduce left-to-right (last)
      • reduce right-to-left (last)
      • windowed reduce right-to-left (last)
      • scan (on prefixes) top-to-bottom (first)
      • scan (on suffixes) bottom-to-top (first)
      • scan (on prefixes) left-to-right (last)
      • scan (on suffixes) right-to-left (last)
      • ¨ each
      • each-left?
      • each-right?
      • repeat (with inverses?)
      • until
      • inner product
      • alternant?
      • outer product
      • at rank
      • at depth
      • @ at
      • key
      • key with vocabulary
      • diagonals?
      • stencil
      • valences (call left if monad and right if dyad)
      • strucutral under
    • combinators
      • constant
      • commute
      • duplicate
      • bind argument
      • after
      • default argument (uses operand if called monadically, and argument if called dyadically)
      • before (not a hook!)
      • left hook
      • right hook
      • atop
      • over
      • mirror (_{(⍵ ⍹⍹ ⍺)⍶⍶(⍺ ⍹⍹ ⍵)}_)
      • «/» fork?
  • system names (quad names)
    • support for system names in parsing and interpreting
    • system arrays (nilads, i guess)
      • ⎕u (constant) the uppercase alphabet
      • ⎕l (constant) the lowercase alphabet
      • ⎕d (constant) the digits
      • ⎕ts current Unix timestamp
      • ⎕io (constant) 1
      • ⎕ct (constant) 1⏨¯14
      • ⎕seed (set only) seed the random number generator
    • system functions
      • ⎕File read/write files
      • ⎕DateTime (or ⎕DT maybe?) convert between time formats
      • ⎕HTTP http requests
      • ⎕CSV convert from/to CSV
      • ⎕JSON convert from/to JSON
      • ⎕Unicode convert between unicode representations
      • ⎕Exists does a variable exist?
      • ⎕C/⎕Case case fold/uppercase/lowercase
    • system adverbs
      • ⎕_BinFile read/write binary files, with format chosen from the operand
    • system conjunctions

About

TinyAPL, a tiny APL dialect and interpreter in Haskell

Resources

License

Stars

Watchers

Forks

Packages

No packages published