summaryrefslogtreecommitdiff
path: root/examples/list.sin
diff options
context:
space:
mode:
authorTom Harley2020-01-08 14:14:39 +0000
committerTom Harley2020-01-08 14:14:39 +0000
commit4cdc57ce8041aecabd3175f2dff176b115f17724 (patch)
treeda9a25e2d18ce5f4415d4c61441962e9e06ee727 /examples/list.sin
parentcheckpoint (diff)
downloadsinter-4cdc57ce8041aecabd3175f2dff176b115f17724.tar.gz
sinter-4cdc57ce8041aecabd3175f2dff176b115f17724.zip

I should commit more

Diffstat (limited to 'examples/list.sin')
-rw-r--r--examples/list.sin53
1 files changed, 0 insertions, 53 deletions
diff --git a/examples/list.sin b/examples/list.sin
deleted file mode 100644
index 5952ae3..0000000
--- a/examples/list.sin
+++ /dev/null
@@ -1,53 +0,0 @@
-[type list_ [kind head tail]]
-[type nil_ [kind]]
-
-[def list [head tail]
- [list_ 1 head tail]]
-
-[def nil []
- [nil_ 0]]
-
-[def head [xs]
- [list_.head xs]]
-
-[def tail [xs]
- [list_.tail xs]]
-
-[def has_tail [xs]
- [nil_.kind xs]]
-
-[def is_nil [x]
- [if [nil_.kind x]
- 0
- 1]]
-
-[def concat [as bs]
- [list [head as]
- [if [is_nil [tail as]]
- bs
- [concat [tail as] bs]]]]
-
-[def alt_concat [as bs]
- [if [is_nil [tail as]]
- [list [head as] bs]
- [list [head as] [concat [tail as] bs]]]]
-
-[def prepend [x xs]
- [list x xs]]
-
-[def append [xs x]
- [if [is_nil xs]
- [list [debug_int x] [nil]]
- [list [head xs] [append [tail xs] x]]]]
-
-[def map [xs f]
- [if [is_nil xs]
- xs
- [list [f [head xs]]
- [map [tail xs] f]]]]
-
-[def debug_list_int [xs]
- [if [is_nil xs]
- xs
- [list [debug_int [head xs]]
- [debug_list_int [tail xs]]]]]