Shakti (k9) tutorial

Next:  


k9: Manual

This manual is for Shakti (k9) build 2023.03.09.

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

Learning k9 means code like {x@(!#x)+\!#y} is clear and actually prefered to something much longer and verbose. You’ll have to go a bit down the rabbit hole before it starts to come together but once it does you’ll probably be happy you gave it a chance and end up learning a few things. You’ll understand how fast k9 can be in processing and analyzing data and how terse code is less likely to contain errors. Unfortunately you will be less likely to be content using more bloated and slow frameworks.

Alas this manual is not as elegant as the k9 language in that the text version of this document is almost as big as the binary of the language.

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

["Tdtcnghije"]2'`t.csv;[#!@*.[^]]`t.csv;1'stdout;2'stderr
select count last min max sum avg var dev .. by ..;in log exp

Verb      unary        Adverb        Type
+  +      flip         ' each        char   " ab"          
-  -      -            / over        sym    ``ab
*  *      first        \ scan        bool   011b   
%  div    sqrt                       int    2 3 4
!  mod    key          System        float  2 3e4          
&  &      where        \l load      -fixed  2.0 3.4
|  |      reverse      \t time      -locus  -74::40.7      
<  <      asc          \v vars   z.d date   2001.02.03  
>  >      desc         \w work   z.t time   12:34:56.789
=  =      freq                   z.T datetime
~  ~      ~                                       
,  ,      ,
#  take   count        I/O           Class      
_  drop   floor     [n]0' line       expr   :2+a
^  cut    sort      [n]1' char       func   f[a]:2+a
@  @      type    [nft]2' data               
?  find   distinct    *3' set        list   (2;3.4)  
$  parse  str         *4' get        dict   {a:2 3}
.  dict   value       *5' ffi        table  [a:2 3]


Next: