Shakti tutorial

k9: Manual

The Shakti programming language is the work of Arthur Whitney and the team at Shakti. The language comes from lineage of similar languages going back to APL. It’s also known as k9 given the similarties to k, k2, ..., k8 and the fact that Arthur also wrote those. k9 is still under development so expect a bit of syntax change and likley even more improvements.

This manual is for Shakti (k9) build 2020.09.13.



The built-in reference screen containing all the k9 commands.

Verb Adverb Noun System : x y f' each bool 011b \l a.k + flip plus d/ over c/ i/ int 0N 0 2 3 \t:n x - negate minus d\ scan c\ i\ flt 0n 0 2 3.4 \u:n x * first times d': eachprior char " ab" \v % divide d/: eachright f-over name ``ab \w & where min/and d\: eachleft f-scan uuid \cd x | reverse max/or < asc less .z.DTV date 2024.01.01T12:34:56 > dsc more .z.dtv time 12:34:56.123456789 = group equal ~ not match Class ! enum key List (2;3.4;`a) , enlist cat Dict {x:2;y:`a} ^ sort [f]cut Func {[x;y]x+y} # count [f]take Expr :x+y _ floor [f]drop $ string cast/mmu $[b;x;y] if else \f [x] ? unique find/rnd *?[x;i;f[;y]] splice Table [[]a:..;..] \ft [x] @ type at @[x;i;f[;y]] amend NTable `a.![[]..] \fc [x] . value dot .[x;i;f[;y]] dmend TTable [[a:..]..] \fl [x] \\ exit sqrt exp log sin cos div mod bar; count first last min max sum avg; in bin select A by B from T where C (*select[C;T;B;A]) x~`json?`json x:(23;3.4;"ab"); x~`csv?`csv x I/O: 0:line 1:char *[2:data 3:kipc/set 4:http/get] FFI: "./a.so"2:`f!"i" /I f(I i){return 1+i;} //cblas .. k/c: "./b.so"2:`f!1 /K f(K x){return ki(1+xi);} //feeds .. python: import k; k.k('+',2,3) nodejs: k=require('k');k.k('+',2,3) limit: {[param8]local8 global32 const128 jump256} name8 error: class rank length type domain value(parse stack limit)