aboutsummaryrefslogtreecommitdiffstats
path: root/examples/impure-concept.milch
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-12-06 22:12:43 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-06 22:12:43 +0200
commitd8850b22d21e1a034ed558289c08d36ddd2f796d (patch)
treea29b50d0bba7fb9e25726d4230ba2f9235e18e17 /examples/impure-concept.milch
parent235782f210e99ac063b78907d17a049a0a94a50a (diff)
Fix examples/impure-concept.milch
Diffstat (limited to 'examples/impure-concept.milch')
-rw-r--r--examples/impure-concept.milch10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/impure-concept.milch b/examples/impure-concept.milch
index 75c3bb7..0a9af05 100644
--- a/examples/impure-concept.milch
+++ b/examples/impure-concept.milch
@@ -1,3 +1,5 @@
+(import "core/common")
+
; What color is your function?
; Impure functions are functions that can call both pure and impure functions.
; Pure functions can only call pure functions.
@@ -11,7 +13,7 @@
(f 10) ; works
; this is an impure function
-(let g! (\![x] (println! x)))
+(let g! (\![x] (print-fmt! "{0}\n" [x])))
(g! "foo") ; works
@@ -20,6 +22,6 @@
(h "bar")
; error: cannot call impure function in pure context
-; when calling function g! at examples/purity-test.milch:19:15
-; in a function definition at examples/purity-test.milch:19:12
-; when calling function h at examples/purity-test.milch:21:1 \ No newline at end of file
+; when calling function g! at examples/impure-concept.milch:21:14
+; in a function definition at examples/impure-concept.milch:21:11
+; when calling function h at examples/impure-concept.milch:23:1 \ No newline at end of file