Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 74 lines (50 sloc) 0.858 kB
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
1 let $+ +
31413fc @akkartik 1895 - more consistent local names
authored
2 def! + args
3 (reduce $+ args 0)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
4
5 let $- -
31413fc @akkartik 1895 - more consistent local names
authored
6 def! - args
7 (reduce $- args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
8
9 let $* *
31413fc @akkartik 1895 - more consistent local names
authored
10 def! * args
11 (reduce $* args 1)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
12
13 let $/ /
31413fc @akkartik 1895 - more consistent local names
authored
14 def! / args
15 (reduce $/ args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
16
17 let $% %
31413fc @akkartik 1895 - more consistent local names
authored
18 def! % args
19 (reduce $% args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
20
7b347e4 @akkartik 1731
authored
21 mac ++(n)
22 `(= ,n (+ ,n 1))
23
24 mac --(n)
25 `(= ,n (- ,n 1))
26
27
28
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
29 let $< <
31413fc @akkartik 1895 - more consistent local names
authored
30 def! < args
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
31 (all (fn((x y)) ($< x y))
31413fc @akkartik 1895 - more consistent local names
authored
32 pairwise.args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
33
31413fc @akkartik 1895 - more consistent local names
authored
34 def > args
9204470 @akkartik 1633 - complete string comparison operators
authored
35 (all (fn((x y)) (< y x))
31413fc @akkartik 1895 - more consistent local names
authored
36 pairwise.args)
9204470 @akkartik 1633 - complete string comparison operators
authored
37
31413fc @akkartik 1895 - more consistent local names
authored
38 def <= args
9204470 @akkartik 1633 - complete string comparison operators
authored
39 (none (fn((x y)) (< y x))
31413fc @akkartik 1895 - more consistent local names
authored
40 pairwise.args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
41
31413fc @akkartik 1895 - more consistent local names
authored
42 def >= args
9204470 @akkartik 1633 - complete string comparison operators
authored
43 (none (fn((x y)) (< x y))
31413fc @akkartik 1895 - more consistent local names
authored
44 pairwise.args)
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
45
61790a1 @akkartik 1732 - min/max
authored
46 def min args
47 (best < args)
48
49 def max args
50 (best > args)
51
2d25c57 @akkartik 1894 - new idiom for comparers in sort
authored
52 def <(scorer) :case fn?.scorer
53 (fn(x y)
54 (< scorer.x scorer.y))
55
529fd12 @akkartik 1559 - tests now pass; mfn is indeed redundant
authored
56
57
58 def zero?(n)
59 (iso n 0)
60
61 def divides(nr dr)
62 (zero?:% nr dr)
63
64 def even?(n)
65 (divides n 2)
66
5a4aee9 @akkartik 1878
authored
67 alias odd? ~even?
f07981f @akkartik 1728 - add/multiply now handle 0 or 1 args
authored
68
31413fc @akkartik 1895 - more consistent local names
authored
69 def sum(seq)
70 (+ @seq)
f07981f @akkartik 1728 - add/multiply now handle 0 or 1 args
authored
71
31413fc @akkartik 1895 - more consistent local names
authored
72 def product(seq)
73 (* @seq)
Something went wrong with that request. Please try again.