Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
29
Task/Power-set/EchoLisp/power-set.echolisp
Normal file
29
Task/Power-set/EchoLisp/power-set.echolisp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
(define (set-cons a A)
|
||||
(make-set (cons a A)))
|
||||
|
||||
(define (power-set e)
|
||||
(cond ((null? e)
|
||||
(make-set (list ∅)))
|
||||
(else (let [(ps (power-set (cdr e)))]
|
||||
(make-set
|
||||
(append ps (map set-cons (circular-list (car e)) ps)))))))
|
||||
|
||||
(define B (make-set ' ( 🍎 🍇 🎂 🎄 )))
|
||||
(power-set B)
|
||||
→ { ∅ { 🍇 } { 🍇 🍎 } { 🍇 🍎 🎂 } { 🍇 🍎 🎂 🎄 } { 🍇 🍎 🎄 } { 🍇 🎂 } { 🍇 🎂 🎄 }
|
||||
{ 🍇 🎄 } { 🍎 } { 🍎 🎂 } { 🍎 🎂 🎄 } { 🍎 🎄 } { 🎂 } { 🎂 🎄 } { 🎄 } }
|
||||
|
||||
;; The Von Neumann universe
|
||||
|
||||
(define V0 (power-set null)) ;; null and ∅ are the same
|
||||
→ { ∅ }
|
||||
(define V1 (power-set V0))
|
||||
→ { ∅ { ∅ } }
|
||||
(define V2 (power-set V1))
|
||||
→ { ∅ { ∅ } { ∅ { ∅ } } { { ∅ } } }
|
||||
(define V3 (power-set V2))
|
||||
→ { ∅ { ∅ } { ∅ { ∅ } } …🔃 )
|
||||
(length V3) → 16
|
||||
(define V4 (power-set V3))
|
||||
(length V4) → 65536
|
||||
;; length V5 = 2^65536 : out of bounds
|
||||
Loading…
Add table
Add a link
Reference in a new issue