@@ -10,38 +10,48 @@ Add
11Produces the sum of `a` and `b`.
11Produces the sum of `a` and `b`.
13−Accepts
13+#### Accepts
16`a` is an atom.
15`a` is an atom.
18`b` is an atom.
17`b` is an atom.
20−Produces
19+#### Produces
28− ++ add :: add
25+ ++ add
30− |= [a/@ b/@]
27+ |= [a=@ b=@]
32 ?: =(0 a) b
29 ?: =(0 a) b
33 $(a (dec a), b +(b))
30 $(a (dec a), b +(b))
35−Examples
32+#### Examples
38 > (add 2 2)
34 > (add 2 2)
40 > (add 1 1.000.000)
37 > (add 1 1.000.000)
42 > (add 1.333 (mul 2 2))
40 > (add 1.333 (mul 2 2))
46### `++dec`
56### `++dec`
@@ -49,22 +59,19 @@ Decrement
50Decrements `a` by `1`.
60Decrements `a` by `1`.
52−Accepts
62+#### Accepts
55`a` is an atom.
64`a` is an atom.
57−Produces
66+#### Produces
65− ++ dec :: decrement
72+ ++ dec
68 ~| %decrement-underflow
75 ~| %decrement-underflow
@@ -72,15 +79,25 @@ Source
72 ?: =(a +(b)) b
79 ?: =(a +(b)) b
75−Examples
82+#### Examples
81 ! decrement-underflow
88 ! decrement-underflow
@@ -88,82 +105,135 @@ Examples
91−Computes `a` divided by `b`.
108+Computes `a` divided by `b` without remainder.
93−Accepts
110+#### Accepts
96`a` is an atom.
112`a` is an atom.
98`b` is an atom.
114`b` is an atom.
100−Produces
116+#### Produces
105−Source
120+#### Source
108− ++ div :: divide
122+ ++ div
110− |= [a/@ b/@]
124+ |: [a=`@`1 b=`@`1]
112− ~| 'div'
126+ ~_ leaf+"divide-by-zero"
113 ?< =(0 b)
127 ?< =(0 b)
116 ?: (lth a b) c
130 ?: (lth a b) c
117 $(a (sub a b), c +(c))
131 $(a (sub a b), c +(c))
120−Examples
134+#### Examples
123 > (div 4 2)
137 > (div 4 2)
125 > (div 17 8)
140 > (div 17 8)
127 > (div 20 30)
143 > (div 20 30)
160+Divide with remainder
162+Computes `a` divided by `b`, producing the quotient and the remainder.
180+ [(div a b) (mod a b)]
132### `++gte`
204### `++gte`
134Greater-than/equal
206Greater-than/equal
136−Tests whether `a` is greater than a number `b`.
208+Tests whether `a` is greater than or equal to `b`.
138−Accepts
210+#### Accepts
141`a` is an atom.
212`a` is an atom.
143`b` is an atom.
214`b` is an atom.
145−Produces
216+#### Produces
148−A boolean.
218+A flag.
150−Source
220+#### Source
153− ++ gte :: greater-equal
222+ ++ gte
155− |= {a/@ b/@}
224+ |= [a=@ b=@]
157 !(lth a b)
226 !(lth a b)
160−Examples
229+#### Examples
163 > (gte 100 10)
231 > (gte 100 10)
165 > (gte 4 4)
234 > (gte 4 4)
167 > (gte 3 4)
237 > (gte 3 4)
@@ -176,37 +246,36 @@ Greater-than
177Tests whether `a` is greater than `b`.
247Tests whether `a` is greater than `b`.
179−Accepts
249+#### Accepts
182`a` is an atom.
251`a` is an atom.
184`b` is an atom.
253`b` is an atom.
186−Produces
255+#### Produces
189−A boolean.
257+A flag.
191−Source
259+#### Source
194− ++ gth :: greater-than
261+ ++ gth
196− |= {a/@ b/@}
263+ |= [a=@ b=@]
198 !(lte a b)
265 !(lte a b)
202−Examples
269+#### Examples
205 > (gth 'd' 'c')
271 > (gth 'd' 'c')
207 > (gth ~h1 ~m61)
274 > (gth ~h1 ~m61)
277+ > (gth 'steak' 'brisket')
@@ -216,41 +285,53 @@ Less-than/equal
217Tests whether `a` is less than or equal to `b`.
286Tests whether `a` is less than or equal to `b`.
219−Accepts
288+#### Accepts
222`a` is an atom.
290`a` is an atom.
224`b` is an atom.
292`b` is an atom.
226−Produces
294+#### Produces
229−A boolean.
296+A flag.
231−Source
298+#### Source
234− ++ lte :: less-equal
300+ ++ lte
236− |= {a/@ b/@}
302+ |= [a=@ b=@]
237 |(=(a b) (lth a b))
303 |(=(a b) (lth a b))
241−Examples
306+#### Examples
244 > (lte 4 5)
308 > (lte 4 5)
246 > (lte 5 4)
311 > (lte 5 4)
248 > (lte 5 5)
314 > (lte 5 5)
250 > (lte 0 0)
317 > (lte 0 0)
328+ > (lte 'abraham' 'bob')
256### `++lth`
337### `++lth`
@@ -259,24 +340,21 @@ Less-than
260Tests whether `a` is less than `b`.
341Tests whether `a` is less than `b`.
262−Accepts
343+#### Accepts
265`a` is an atom.
345`a` is an atom.
267`b` is an atom.
347`b` is an atom.
269−Produces
349+#### Produces
272−A boolean.
351+A flag.
274−Source
353+#### Source
277− ++ lth :: less-than
355+ ++ lth
279− |= {a/@ b/@}
357+ |= [a=@ b=@]
281 ?& !=(a b)
359 ?& !=(a b)
@@ -285,18 +363,30 @@ Source
285 $(a (dec a), b (dec b))
363 $(a (dec a), b (dec b))
288−Examples
366+#### Examples
291 > (lth 4 5)
368 > (lth 4 5)
293 > (lth 5 4)
371 > (lth 5 4)
295 > (lth 5 5)
374 > (lth 5 5)
297 > (lth 5 0)
377 > (lth 5 0)
387+ > (lth 'abraham' 'bob')
302### `++max`
392### `++max`
@@ -305,39 +395,50 @@ Maximum
306Computes the greater of `a` and `b`.
396Computes the greater of `a` and `b`.
308−Accepts
398+#### Accepts
311`a` is an atom.
400`a` is an atom.
313`b` is an atom.
402`b` is an atom.
315−Produces
404+#### Produces
320−Source
408+#### Source
323− ++ max :: maximum
410+ ++ max
325− |= {a/@ b/@}
412+ |= [a=@ b=@]
327 ?: (gth a b) a
414 ?: (gth a b) a
330−Examples
417+#### Examples
333 > (max 10 100)
419 > (max 10 100)
335 > (max 10.443 9)
422 > (max 10.443 9)
337− > (max 0 1)
425+ > (max 1 1)
428+ > (max 'abraham' 'bob')
429+ 30.787.873.400.840.801
431+ > `@t`(max 'abraham' 'bob')
434+ > `@t`(max 'abraham' 'benjamin')
437+ > `@dr`(max ~m6 ~h1)
440+ >`@ux`(max 0xe1 0x1e)
343### `++min`
444### `++min`
@@ -346,37 +447,47 @@ Minimum
347Computes the lesser of `a` and `b`.
448Computes the lesser of `a` and `b`.
349−Accepts
450+#### Accepts
352`a` is an atom.
452`a` is an atom.
354`b` is an atom.
454`b` is an atom.
356−Produces
456+#### Produces
361−Source
460+#### Source
364− ++ min :: minimum
462+ ++ min
366− |= {a/@ b/@}
464+ |= [a=@ b=@]
368 ?: (lth a b) a
466 ?: (lth a b) a
371−Examples
469+#### Examples
374 > (min 10 100)
471 > (min 10 100)
376 > (min 10.443 9)
474 > (min 10.443 9)
378− > (min 0 1)
477+ > (min 1 1)
480+ > (min 'abraham' 'bob')
483+ > `@t`(min 'abraham' 'bob')
486+ > `@t`(min 'abraham' 'benjamin')
489+ > `@dr`(min ~m6 ~h1)
@@ -387,37 +498,47 @@ Modulus
388Computes the remainder of dividing `a` by `b`.
499Computes the remainder of dividing `a` by `b`.
390−Accepts
501+#### Accepts
393`a` is an atom.
503`a` is an atom.
395`b` is an atom.
505`b` is an atom.
397−Produces
507+#### Produces
402−Source
511+#### Source
405− ++ mod :: remainder
513+ ++ mod
407 |: [a=`@`1 b=`@`1]
515 |: [a=`@`1 b=`@`1]
409 ?< =(0 b)
517 ?< =(0 b)
410 (sub a (mul b (div a b)))
518 (sub a (mul b (div a b)))
413−Examples
521+#### Examples
416 > (mod 5 2)
524 > (mod 5 2)
418 > (mod 5 5)
527 > (mod 5 5)
@@ -427,22 +548,19 @@ Multiply
428Multiplies `a` by `b`.
549Multiplies `a` by `b`.
430−Accepts
551+#### Accepts
433`a` is an atom.
553`a` is an atom.
435`b` is an atom.
555`b` is an atom.
437−Produces
557+#### Produces
442−Source
561+#### Source
445− ++ mul :: multiply
563+ ++ mul
447 |: [a=`@`1 b=`@`1]
565 |: [a=`@`1 b=`@`1]
@@ -450,15 +568,25 @@ Source
451 ?: =(0 a) c
569 ?: =(0 a) c
452 $(a (dec a), c (add b c))
570 $(a (dec a), c (add b c))
454−Examples
572+#### Examples
457 > (mul 3 4)
574 > (mul 3 4)
459− > (mul 0 1)
577+ > (mul 0 1)
587+ >`@ux`(mul 0x1f 0xe)
@@ -468,42 +596,54 @@ Subtract
469Subtracts `b` from `a`.
597Subtracts `b` from `a`.
471−Accepts
599+#### Accepts
474`a` is an atom.
601`a` is an atom.
476`b` is an atom.
603`b` is an atom.
478−Produces
605+#### Produces
483−Source
609+#### Source
486− ++ sub :: subtract
611+ ++ sub
488− |= [a/@ b/@]
613+ |= [a=@ b=@]
489− ~| %subtract-underflow
614+ ~_ leaf+"subtract-underflow"
491 ?: =(0 b) a
616 ?: =(0 b) a
492 $(a (dec a), b (dec b))
617 $(a (dec a), b (dec b))
494−Examples
621+#### Examples
497 > (sub 10 5)
623 > (sub 10 5)
499 > (sub 243 44)
626 > (sub 243 44)
501 > (sub 5 0)
629 > (sub 5 0)
503 > (sub 0 5)
632 > (sub 0 5)
504 ! subtract-underflow
633 ! subtract-underflow
645+ > `@ux`(sub 0x1f 0xe)