aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org78
-rw-r--r--package.lisp1
2 files changed, 79 insertions, 0 deletions
diff --git a/README.org b/README.org
index e3a9ef2..ac4f9f1 100644
--- a/README.org
+++ b/README.org
@@ -129,3 +129,81 @@ This is easer to understand through example:
Outputs
: ((1 2 3 4 5 6 7 8 9) (1 2 3 3 5 6 7 8 9))
+
+** Other tools
+
+*** rev
+
+#+begin_src lisp :results verbatim
+
+(funcall (riff:rev #'cons) 1 2)
+
+
+#+end_src
+
+#+RESULTS:
+: (2 . 1)
+
+*** closure
+
+#+begin_src lisp :results verbatim
+
+(let ((x 0))
+ (let ((inc
+ (riff:closure
+ (incf x))))
+ (funcall inc :these :will :all :be :ignored)
+ (funcall inc)))
+
+
+#+end_src
+
+#+RESULTS:
+: 2
+
+*** mapped
+
+#+begin_src lisp :results verbatim
+
+(funcall (riff:mapped #$(+ 10 $x) #$(format nil "--~a--" $x))
+ 100)
+
+
+#+end_src
+
+#+RESULTS:
+: (110 "--100--")
+
+*** lambda-if
+
+#+begin_src lisp :results verbatim
+
+(let ((decide
+ (riff:lambda-if #'evenp
+ #$(format nil "It's even: ~a~%" $x)
+ #$(format nil "It's odd: ~a~%" $x))))
+ (funcall decide 10))
+
+
+#+end_src
+
+#+RESULTS:
+: It's even: 10
+
+*** lambda-cond
+
+#+begin_src lisp :results verbatim
+(let ((decider
+ (riff:lambda-cond
+ #$(< (length $x) 10) (constantly "It's short.")
+ #$(<= 10 (length $x) 20) #$(format nil "Medium length: ~a" (length $x))
+ (constantly t) (constantly "Longish"))))
+
+ (mapcar decider (list "short" "this is a bit longer" "and this one is too long probably")))
+
+#+end_src
+
+#+RESULTS:
+: ("It's short." "Medium length: 20" "Longish")
+
+
diff --git a/package.lisp b/package.lisp
index 280a253..545f61e 100644
--- a/package.lisp
+++ b/package.lisp
@@ -2,6 +2,7 @@
(defpackage #:lambda-riffs
(:use #:cl)
+ (:nicknames #:riff)
(:export #:closure
#:mapped
#:rev