aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-03-14 12:12:07 -0500
committerColin Okay <okay@toyful.space>2021-03-14 12:12:07 -0500
commit225b28dee4a19d50e1e0c85a180b62eb73f170bc (patch)
treeaf0251efa5af145bf6a260986858665d6afa02ea
parenteca5721faa65477f9adfc3f5a5627435f9e005b1 (diff)
renamed function in example
-rw-r--r--README.md16
1 files changed, 8 insertions, 8 deletions
diff --git a/README.md b/README.md
index 6eefa12..3a6c383 100644
--- a/README.md
+++ b/README.md
@@ -108,26 +108,26 @@ example apears at the end of the document, following the tutorial.
``` lisp
-(defun all-subsets (list)
+(defun powerset (list)
"Generate the set of all subsets of a given set."
(if (null list) (seq (list nil))
- (concat! (all-subsets (cdr list))
+ (concat! (powerset (cdr list))
(map! (lambda (sub) (cons (car list) sub))
- (all-subsets (cdr list))))))
+ (powerset (cdr list))))))
-> (collect (all-subsets '()))
+> (collect (powerset '()))
(NIL)
-> (collect (all-subsets '(1)))
+> (collect (powerset '(1)))
(NIL (1))
-> (collect (all-subsets '(1 2)))
+> (collect (powerset '(1 2)))
(NIL (2) (1) (1 2))
-> (collect (all-subsets '(1 2 3)))
+> (collect (powerset '(1 2 3)))
(NIL (3) (2) (2 3) (1) (1 3) (1 2) (1 2 3))
-> (collect (all-subsets '(1 2 3 4)))
+> (collect (powerset '(1 2 3 4)))
(NIL (4) (3) (3 4) (2) (2 4) (2 3) (2 3 4) (1) (1 4) (1 3) (1 3 4) (1 2)
(1 2 4) (1 2 3) (1 2 3 4))