diff options
| author | Drahflow <drahflow@gmx.de> | 2019-03-20 19:19:38 +0100 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2019-03-20 19:19:38 +0100 |
| commit | db73f1d126945311b4acea1f484b2af42c4094fe (patch) | |
| tree | 3837c1354467bd357b03ed1184208f292644944c /examples/working-compiler | |
| parent | 36b1d920bc3cf46884ad7fb51106c3d7be29759a (diff) | |
How not to do lists. :P
Diffstat (limited to 'examples/working-compiler')
| -rw-r--r-- | examples/working-compiler/list-spell.ey | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/working-compiler/list-spell.ey b/examples/working-compiler/list-spell.ey new file mode 100644 index 0000000..a5d09c8 --- /dev/null +++ b/examples/working-compiler/list-spell.ey @@ -0,0 +1,22 @@ +# Implementing the list spell by Aphyr + +{ ==h { h ? 1 }_ } =*cons + +{ } "3" cons "2" cons "1" cons ==x +x dump + +{ =*l _ { 1 sub 1 l -- nth } { -- 0 l -- } ? * } =*nth + +{ [ -01 { 0 -01*1 -01 } { 1 -01* -- } loop -1 ] dump } =*dumpList + +x dumpList + +{ { { } } -01 + { =*r =*l + 0 l { + { -1*0 cons } 1 l -- |r r + } rep + } _ * * +} =*reverse + +x reverse dumpList |
