All Projects → zholos → kuc

zholos / kuc

Licence: GPL-3.0 license
vector programming language

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language

kuc is a vector programming language with closures.

Compiling

Run make to build. Edit the Makefile to configure.

Examples

Lexical closures and garbage collection:

kuc> {a:!x;.{a+1}} 5                    # closures
kuc> {b:a:!x;.{a+:1;b::|b};(a;b)} 5     # closures!
kuc> o:.{a:0;`add`show!{a+:x},{show a}} # objects
kuc> (o`add) 5; (o`add) 7; .o`show

Simple JIT:

kuc> ackermann:{$[x;self[x-1;$[y;self[x;y-1];1]];y+1]}
kuc> time {ackermann[3;9]}
kuc> disasm ackermann # tail-call-to-self optimization
kuc> time {-1+|/(#{@[x;!*|x;|:]}\)'1+!-7} # fannkuch

More new language features:

kuc> {[x]{[y]y-x}}[3;5] # curried functions
kuc> _17%5     # compound operators (cf (_:)17%5)
kuc> ~^108810b # null bool
kuc> write[`:/dev/stdout]"Hello, world!\n";

Also see the test programs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].