2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
13
Task/Y-combinator/TXR/y-combinator-1.txr
Normal file
13
Task/Y-combinator/TXR/y-combinator-1.txr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
;; The Y combinator:
|
||||
(defun y (f)
|
||||
[(op @1 @1)
|
||||
(op f (op [@@1 @@1]))])
|
||||
|
||||
;; The Y-combinator-based factorial:
|
||||
(defun fac (f)
|
||||
(do if (zerop @1)
|
||||
1
|
||||
(* @1 [f (- @1 1)])))
|
||||
|
||||
;; Test:
|
||||
(format t "~s\n" [[y fac] 4])
|
||||
1
Task/Y-combinator/TXR/y-combinator-2.txr
Normal file
1
Task/Y-combinator/TXR/y-combinator-2.txr
Normal file
|
|
@ -0,0 +1 @@
|
|||
(op foo @1 (op bar @2 @@2))
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
@(do
|
||||
;; The Y combinator:
|
||||
(defun y (f)
|
||||
[(op @1 @1)
|
||||
(op f (op [@@1 @@1]))])
|
||||
|
||||
;; The Y-combinator-based factorial:
|
||||
(defun fac (f)
|
||||
(do if (zerop @1)
|
||||
1
|
||||
(* @1 [f (- @1 1)])))
|
||||
|
||||
;; Test:
|
||||
(format t "~s\n" [[y fac] 4]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue