Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
4
Task/Currying/Clojure/currying.clj
Normal file
4
Task/Currying/Clojure/currying.clj
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(def plus-a-hundred (partial + 100))
|
||||
(assert (=
|
||||
(plus-a-hundred 1)
|
||||
101))
|
||||
1
Task/Currying/JavaScript/currying-2.js
Normal file
1
Task/Currying/JavaScript/currying-2.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(a,b) => expr_using_a_and_b
|
||||
1
Task/Currying/JavaScript/currying-3.js
Normal file
1
Task/Currying/JavaScript/currying-3.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
a => b => expr_using_a_and_b
|
||||
23
Task/Currying/JavaScript/currying-4.js
Normal file
23
Task/Currying/JavaScript/currying-4.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
let
|
||||
fix = // This is a variant of the Applicative order Y combinator
|
||||
f => (f => f(f))(g => f((...a) => g(g)(...a))),
|
||||
curry =
|
||||
f => (
|
||||
fix(
|
||||
z => (n,...a) => (
|
||||
n>0
|
||||
?b => z(n-1,...a,b)
|
||||
:f(...a)))
|
||||
(f.length)),
|
||||
curryrest =
|
||||
f => (
|
||||
fix(
|
||||
z => (n,...a) => (
|
||||
n>0
|
||||
?b => z(n-1,...a,b)
|
||||
:(...b) => f(...a,...b)))
|
||||
(f.length)),
|
||||
curriedmax=curry(Math.max),
|
||||
curryrestedmax=curryrest(Math.max);
|
||||
print(curriedmax(8)(4),curryrestedmax(8)(4)(),curryrestedmax(8)(4)(9,7,2));
|
||||
// 8,8,9
|
||||
3
Task/Currying/Logtalk/currying.logtalk
Normal file
3
Task/Currying/Logtalk/currying.logtalk
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
| ?- logtalk << call([Z]>>(call([X,Y]>>(Y is X*X), 5, R), Z is R*R), T).
|
||||
T = 625
|
||||
yes
|
||||
3
Task/Currying/Scala/currying.scala
Normal file
3
Task/Currying/Scala/currying.scala
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def add(a: Int)(b: Int) = a + b
|
||||
val add5 = add(5) _
|
||||
add5(2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue