summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3ea66f0..d60153b 100644
--- a/README.md
+++ b/README.md
@@ -304,6 +304,31 @@ variable number of arguments:
(+ x +1)) ; #<Lambda (x)>
(plus1 +2) ; +3
+### Other list operations
+
+`(nth x y)` takes a positive number `x` and a list `y`, returns the element of
+list `y` at position `x`:
+
+ (nth +0 '(a b c)) ; a
+ (nth +9 '(a b c)) ; ()
+
+`(append x y)` returns a list of appending the list `x` to `y`:
+
+ (append '(a b) 'c) ; (a b . c)
+ (append '(a b) '(c)) ; (a b c)
+
+`(reverse x)` returns list `x` reversed:
+
+ (reverse '(a b c)) ; (c b a)
+
+`(map name x)` takes a lambda in `name` and a list `x`, returning a list where
+`name` lambda was applied to each element of `x`:
+
+ (map (lambda (x)
+ (+ x +1))
+ '(+0 +1 +2)) ; (+1 +2 +3)
+ (map atom '(a (b c) d)) ; (t f t)
+
### Defining macros
`(macro params expr...)` creates an anonymous macro with parameters `params` and