Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,4 @@
(def plus-a-hundred (partial + 100))
(assert (=
(plus-a-hundred 1)
101))

View file

@ -0,0 +1 @@
(a,b) => expr_using_a_and_b

View file

@ -0,0 +1 @@
a => b => expr_using_a_and_b

View 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

View 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

View file

@ -0,0 +1,3 @@
def add(a: Int)(b: Int) = a + b
val add5 = add(5) _
add5(2)