aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/interpreters/blc.bruijn4
-rw-r--r--samples/io/echo.bruijn5
-rw-r--r--samples/io/reverse.bruijn2
3 files changed, 7 insertions, 4 deletions
diff --git a/samples/interpreters/blc.bruijn b/samples/interpreters/blc.bruijn
deleted file mode 100644
index f40bd4a..0000000
--- a/samples/interpreters/blc.bruijn
+++ /dev/null
@@ -1,4 +0,0 @@
-# TODO: understand and reverse engineer this mess
-# by Tromp/Jart
-
-main [(([(0 0)] [[[(((0 [[[[(2 [((4 (2 [((1 (2 [[(2 [((0 1) 2)])]])) (3 [(3 [((2 0) (1 0))])]))])) ((0 (1 [(0 1)])) [((3 [(3 [(1 (0 3))])]) 4)]))])]]]]) (2 2)) 1)]]]) [(0 ([(0 0)] [(0 0)]))])]
diff --git a/samples/io/echo.bruijn b/samples/io/echo.bruijn
index 192bab1..b17bda1 100644
--- a/samples/io/echo.bruijn
+++ b/samples/io/echo.bruijn
@@ -1,4 +1,9 @@
# "echo text | bruijn echo.bruijn"
+:import std/Monad .
+
# returning the binary encoded argument ⇒ echo
main [0]
+
+# alternative using monads
+main* read >>= return
diff --git a/samples/io/reverse.bruijn b/samples/io/reverse.bruijn
index 7a3553f..d5a0597 100644
--- a/samples/io/reverse.bruijn
+++ b/samples/io/reverse.bruijn
@@ -1,6 +1,8 @@
# "echo tacocat | bruijn reverse.bruijn"
:import std/List .
+:import std/Combinator .
+:import std/Monad .
# stdin is encoded as binary numbers in a list
# reversing the list reverses the input!