Skip to content

Instantly share code, notes, and snippets.

@Zaffer
Zaffer / ski.bend
Created July 24, 2024 23:59
binary recursive function in a tree structure
type C:
App {~x, ~y}
S
K
I
String/concat (String/Nil) str = str
String/concat (String/Cons c rest1) str2 = (String/Cons c (String/concat rest1 str2))
String/join List/Nil = ""
@Zaffer
Zaffer / ski.hvm1
Created July 24, 2024 21:42
HVM1 implementation of SKI combinator
// run with this command: $ hvm1 run -f ski.hvm1 -t 1 "(Main)"
// HVM1 has a bug on the parallelizer (that's what HVM2 fixed) so you need to run with -t 1
// expected output:
// "norm: ((((s ((s s) s)) s) (s s)) k)"
// "norm: (((s ((s s) s)) s) (s s))"
// "norm: ((s ((s s) s)) s)"
// "norm: (s ((s s) s))"
// "norm: ((s s) s)"
// "norm: (s s)"
// "norm: (s s)"