aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-12-09 18:55:21 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-09 18:55:21 +0200
commit8ba98a86805c886719057f9df0d5a74c58c6dabd (patch)
tree8bb5a0890f9a69c01ff219553750058b5da82476 /examples
parentcff5a0dfa89ab3a7f95512382cedf88f8e1709d1 (diff)
Add do builtin
Diffstat (limited to 'examples')
-rw-r--r--examples/do.milch7
-rw-r--r--examples/try.milch7
2 files changed, 8 insertions, 6 deletions
diff --git a/examples/do.milch b/examples/do.milch
new file mode 100644
index 0000000..d66c122
--- /dev/null
+++ b/examples/do.milch
@@ -0,0 +1,7 @@
+(let foo
+ (do (+ 1 2)
+ (- 10 2)
+ "foo"))
+
+foo
+; => "foo"
diff --git a/examples/try.milch b/examples/try.milch
index 561e716..16ac516 100644
--- a/examples/try.milch
+++ b/examples/try.milch
@@ -6,10 +6,5 @@
; calls read-file! and wraps the result in a Result/ok on success
; in case of error, calls Result/ex on the error string
(safe-read-file! "does-not-exist.txt")
-(try! Result/ex (.! Result/ok read-file!) "examples/aoc22_1.txt")
-
-(let pure-fn (\[x]
- (concat "foo" x)))
-(print! (pure-fn "bar\n"))
-(print! "nice\n")
+(try! Result/ex (.! Result/ok read-file!) "examples/aoc22_1.txt")