Paste: forthus anti prelude
Author: | jn |
Mode: | factor |
Date: | Fri, 2 Jan 2009 09:57:02 |
Plain Text |
a = hd
b = hd tl
c = hd tl tl
sq = *[id, id]
0? = eq?[id, 0]
succ = +[id, 1]
pred = -[id, 1]
neg = *[id, -1]
or = if[b, a, (true), (id)]
small? = or[0?, eq?[id, 1]]
fact = if[id, 0?, (1), (*[id, fact pred])]
fib = if[id, small?, (1), (+[fib pred, fib -[id, 2]])]
twice = i[a, i]
double = +[id, id]
quadro = twice[(double), id]
// = [/[a a, b], /[b a, b]]
discr = -[sq b, *[4, *[a, c]]]
roots = //[[+, -][neg b, sqrt discr], *[2, a]]
null? = eq?[id, []]
map = if[id, null? b, ([]), (cons[i[a, hd b], map[a, tl b]])]
fold = if[id, null? c, (b), (fold[a, i[a, [b, hd c]], tl c])]
sum = fold[(+), 0, id]
New Annotation