diff options
| -rw-r--r-- | README.md | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 |
