aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-12-04 22:42:21 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-05 14:21:53 +0200
commit9f4ca350ee81a874b0c838c2e82076efde6db8b2 (patch)
treeb4b54eaa8b09f78e7a91724e37cd63248c42a445 /examples
parent9b4ce32280fdc4298cfc7599491d8e8893de6354 (diff)
Add impure concept
Diffstat (limited to 'examples')
-rw-r--r--examples/impure-concept.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/impure-concept.lisp b/examples/impure-concept.lisp
new file mode 100644
index 0000000..e612339
--- /dev/null
+++ b/examples/impure-concept.lisp
@@ -0,0 +1,12 @@
+; What color is your function?
+; Impure functions are functions that can call both pure and impure functions.
+; Pure functions can only call pure functions.
+; Impure function names end in an exclamation mark (!) by convention.
+; The top-level context is impure but has special rules
+; related to (import!) and (let!).
+
+; pure function
+(let! f (\[x] x))
+
+; impure function
+(let! g (\![x] (print! x)))