diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:19:12 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:21:53 +0200 |
| commit | 4002b8988c799a904ef1f359d4267ef4ad80cba3 (patch) | |
| tree | dbb67560f3a44c57df4b0e960861f60605ceb45f /examples | |
| parent | bba047ae945ae7d7899d6e2c1610923bcedb0442 (diff) | |
Rename project to Milch
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/effects-concept.milch (renamed from examples/effects-concept.lisp) | 0 | ||||
| -rw-r--r-- | examples/import.lisp | 2 | ||||
| -rw-r--r-- | examples/import.milch | 2 | ||||
| -rw-r--r-- | examples/impure-concept.milch (renamed from examples/impure-concept.lisp) | 0 | ||||
| -rw-r--r-- | examples/purity-test.lisp | 20 | ||||
| -rw-r--r-- | examples/purity-test.milch | 25 | ||||
| -rw-r--r-- | examples/records-concept.milch (renamed from examples/records-concept.lisp) | 0 | ||||
| -rw-r--r-- | examples/test.milch (renamed from examples/test.lisp) | 0 | ||||
| -rw-r--r-- | examples/types-concept.milch (renamed from examples/types-concept.lisp) | 0 |
9 files changed, 27 insertions, 22 deletions
diff --git a/examples/effects-concept.lisp b/examples/effects-concept.milch index 5ea90d7..5ea90d7 100644 --- a/examples/effects-concept.lisp +++ b/examples/effects-concept.milch diff --git a/examples/import.lisp b/examples/import.lisp deleted file mode 100644 index 1a2f6f1..0000000 --- a/examples/import.lisp +++ /dev/null @@ -1,2 +0,0 @@ -(import! "stdlib/common.lisp") -(import! M "stdlib/maybe.lisp") diff --git a/examples/import.milch b/examples/import.milch new file mode 100644 index 0000000..e839ef0 --- /dev/null +++ b/examples/import.milch @@ -0,0 +1,2 @@ +(import! "stdlib/common.milch") +(import! M "stdlib/maybe.milch") diff --git a/examples/impure-concept.lisp b/examples/impure-concept.milch index 893b29e..893b29e 100644 --- a/examples/impure-concept.lisp +++ b/examples/impure-concept.milch diff --git a/examples/purity-test.lisp b/examples/purity-test.lisp deleted file mode 100644 index 31e82d3..0000000 --- a/examples/purity-test.lisp +++ /dev/null @@ -1,20 +0,0 @@ -(let! f (\[x] x)) -(f 10) - -(let! g! (\![x] (print! x))) -(g! "foo") - -(let! h (\[x] (g! x))) -(h "bar") - -(let! main! (\![] - (print! (fmt "{0}\n" ["main"])) - )) - -(main!) - -(let! pure-main (\[] - (print! (fmt "{0}\n" ["pure-main"])) - )) - -(pure-main) diff --git a/examples/purity-test.milch b/examples/purity-test.milch new file mode 100644 index 0000000..6e8faea --- /dev/null +++ b/examples/purity-test.milch @@ -0,0 +1,25 @@ +; utils + +(let! println! (\![x] + (print! (fmt "{0}\n" [x])))) + +; pure vs. impure demo + +; this is a pure function +(let! f (\[x] x)) + +(f 10) ; works + +; this is an impure function +(let! g! (\![x] (println! x))) + +(g! "foo") ; works + +; this is a pure function that tries to call an impure function +(let! h (\[x] (g! x))) + +(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 diff --git a/examples/records-concept.lisp b/examples/records-concept.milch index 420fa9f..420fa9f 100644 --- a/examples/records-concept.lisp +++ b/examples/records-concept.milch diff --git a/examples/test.lisp b/examples/test.milch index fd8c379..fd8c379 100644 --- a/examples/test.lisp +++ b/examples/test.milch diff --git a/examples/types-concept.lisp b/examples/types-concept.milch index 8359c6b..8359c6b 100644 --- a/examples/types-concept.lisp +++ b/examples/types-concept.milch |
