diff options
author | Marvin Borner | 2023-03-12 00:04:55 +0100 |
---|---|---|
committer | Marvin Borner | 2023-03-12 00:08:37 +0100 |
commit | 5e5069c5228f2cd39de38ace9134f57293cc7e5d (patch) | |
tree | 525f3a12f8ae5a8d093c756ac5a094a9ccedfe78 /samples | |
parent | e789e11f8e478fe5987101424cf5c9c32cc6a29b (diff) |
Fun
Diffstat (limited to 'samples')
-rw-r--r-- | samples/fun/gen.bruijn | 12 | ||||
-rw-r--r-- | samples/fun/thue-morse.bruijn | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/samples/fun/gen.bruijn b/samples/fun/gen.bruijn new file mode 100644 index 0000000..1333baa --- /dev/null +++ b/samples/fun/gen.bruijn @@ -0,0 +1,12 @@ +# generates long expressions from short ones + +# TODO: This should be linear time according to RKNL paper +# possible reasons: box/map copying, GC + +:import std/Math . + +seed (+23u) + +dup [0 0] + +main [seed dup 0] ⧗ Unary → Woah diff --git a/samples/fun/thue-morse.bruijn b/samples/fun/thue-morse.bruijn new file mode 100644 index 0000000..3f40e01 --- /dev/null +++ b/samples/fun/thue-morse.bruijn @@ -0,0 +1,10 @@ +# printf 10 | bruijn thue-morse.bruijn +# using tromp's solution, prints thue morse sequence + +:import std/Combinator . +:import std/Logic . +:import std/String . + +main [take (number! 0) tm] + xpd z [[[[0 2 [0 [[5 0 1]] (2 4)]]]]] + tm z [xpd true (0 false)] |