diff options
author | Colin Okay <okay@toyful.space> | 2022-02-03 10:05:01 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-03 10:05:01 -0600 |
commit | e2b1c1312f011951ac5cdb133f05991cb3b8aed9 (patch) | |
tree | 2e83533826d744cf3a69d88885d5d5930c5be773 | |
parent | 82fe1c95951d946b532f071bde0033274392e69a (diff) |
editing readme
-rw-r--r-- | README.org | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -23,6 +23,12 @@ Here is a basic example #+begin_src lisp :results verbatim + (let ((xs (list 1 2 3 4 5 6))) + (remove-if-not (lambda (x) (member x xs)) + (loop repeat 20 collect (random 10)))) + + ;; could be written + (let ((xs (list 1 2 3 4 5 6))) (remove-if-not #$(member $x xs) (loop repeat 20 collect (random 10)))) @@ -46,7 +52,6 @@ as a parameter of the anonymous function being defined. Outputs : ((1 2) (10 10 10)) - *** Numbered Parameters Examples of numbered parameters: @@ -77,7 +82,7 @@ Outputs In the above ='second= is passed in as the first argument, and ='first= is passed as the second argument. -Interestingly the numbers do not have to be sequentail, they are +Interestingly the numbers do not have to be sequential, they are merely sorted in ascending order: #+begin_src lisp :results verbatim @@ -102,9 +107,17 @@ This is easer to understand through example: ;; map over a list of lists, subtracting 9 from any member of a list ;; that is greater than 9 -(mapcar #$(mapcar - #$$(if (> $$x 9) (- $$x 9) $$x) ; our nested form - $digit-list) +;; without lambda-riffs, you might do: + +(mapcar (lambda (digit-list) + (mapcar (lambda (x) (if (> x 9) (- x 9) x)) + digit-list)) + '((1 2 3 4 5 6 7 8 9) + (10 11 12 12 14 15 16 17 18))) + +;; with lambda-riffs, you can do + +(mapcar #$(mapcar #$$(if (> $$x 9) (- $$x 9) $$x) $digit-list) '((1 2 3 4 5 6 7 8 9) (10 11 12 12 14 15 16 17 18))) #+end_src |