aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-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))