Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Y-combinator/Clojure/y-combinator-1.clj
Normal file
19
Task/Y-combinator/Clojure/y-combinator-1.clj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(defn Y [f]
|
||||
((fn [x] (x x))
|
||||
(fn [x]
|
||||
(f (fn [& args]
|
||||
(apply (x x) args))))))
|
||||
|
||||
(def fac
|
||||
(fn [f]
|
||||
(fn [n]
|
||||
(if (zero? n) 1 (* n (f (dec n)))))))
|
||||
|
||||
(def fib
|
||||
(fn [f]
|
||||
(fn [n]
|
||||
(condp = n
|
||||
0 0
|
||||
1 1
|
||||
(+ (f (dec n))
|
||||
(f (dec (dec n))))))))
|
||||
2
Task/Y-combinator/Clojure/y-combinator-2.clj
Normal file
2
Task/Y-combinator/Clojure/y-combinator-2.clj
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(defn Y [f]
|
||||
(#(% %) #(f (fn [& args] (apply (% %) args)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue