on master help sign in
update 1a.md
5b5ac86rmariani
docs/hoon/library/1a.md+248−482
@@ -25,23 +25,37 @@ An atom.
25Source
25Source
26------
26------
27
27
28− ++ add :: add
28+ ++ add
29 ~/ %add
29 ~/ %add
30 |= [a=@ b=@]
30 |= [a=@ b=@]
31 ^- @
31 ^- @
32 ?: =(0 a) b
32 ?: =(0 a) b
33 $(a (dec a), b +(b))
33 $(a (dec a), b +(b))
34−
34+::
35Examples
35Examples
36--------
36--------
37
37
38 > (add 2 2)
38 > (add 2 2)
39 4
39 4
40+
40 > (add 1 1.000.000)
41 > (add 1 1.000.000)
41 1.000.001
42 1.000.001
43+
42 > (add 1.333 (mul 2 2))
44 > (add 1.333 (mul 2 2))
43 1.337
45 1.337
44
46
47+ > `@`'a' ::`'a'` is an atom represented as a different data type.
48+ 97 We cast it to the aura `@` to see what its integer representation is.
49+ > (add 'a' 4)
50+ 101
51+ (add 'a' 'b')
52+ 195
53+
54+ > (add 0xc 0xf) ::`0xc` and `0xf` are of the hexadecimal soft atom type (`@ux`).
55+ 27
56+ > `@ux`(add 0xc 0xf)
57+ 0x1b
58+
45***
59***
46### `++dec`
60### `++dec`
47
61
@@ -62,7 +76,7 @@ An atom.
62Source
76Source
63------
77------
64
78
65− ++ dec :: decrement
79+ ++ dec
66 ~/ %dec
80 ~/ %dec
67 |= a=@
81 |= a=@
68 ~_ leaf+"decrement-underflow"
82 ~_ leaf+"decrement-underflow"
@@ -71,16 +85,26 @@ Source
71 |- ^- @
85 |- ^- @
72 ?: =(a +(b)) b
86 ?: =(a +(b)) b
73 $(b +(b))
87 $(b +(b))
74−
88+::
75Examples
89Examples
76--------
90--------
77
91
78 > (dec 7)
92 > (dec 7)
79 6
93 6
94+
80 > (dec 0)
95 > (dec 0)
81 ! decrement-underflow
96 ! decrement-underflow
82 ! exit
97 ! exit
83
98
99+ > (dec 'b')
100+ 97
101+ > `@t`(dec 'b')
102+ 'a'
103+
104+ > (dec 0xc)
105+ 11
106+ > `@ux`(dec 0xc)
107+ 0xb
84
108
85
109
86***
110***
@@ -88,7 +112,7 @@ Examples
88
112
89Divide
113Divide
90
114
91−Computes `a` divided by `b`.
115+Computes `a` divided by `b`. Only a whole number, without the remainder, is produced.
92
116
93Accepts
117Accepts
94-------
118-------
@@ -105,10 +129,9 @@ An atom.
105Source
129Source
106------
130------
107
131
108− ++ div :: divide
132+ ++ div
109 ~/ %div
133 ~/ %div
110 |: [a=`@`1 b=`@`1]
134 |: [a=`@`1 b=`@`1]
111− :> quotient
112 ^- @
135 ^- @
113 ~_ leaf+"divide-by-zero"
136 ~_ leaf+"divide-by-zero"
114 ?< =(0 b)
137 ?< =(0 b)
@@ -117,477 +140,92 @@ Source
117 ?: (lth a b) c
140 ?: (lth a b) c
118 $(a (sub a b), c +(c))
141 $(a (sub a b), c +(c))
119 ::
142 ::
120−
121Examples
143Examples
122--------
144--------
123
145
124 > (div 4 2)
146 > (div 4 2)
125 2
147 2
148+
126 > (div 17 8)
149 > (div 17 8)
127 2
150 2
128− > (div 20 30)
129− 0
130−
131−
132−***
133−### `++gte`
134−
135−Greater-than/equal
136−
137−Tests whether `a` is greater than a number `b`.
138−
139−Accepts
140−-------
141−
142−`a` is an atom.
143−
144−`b` is an atom.
145−
146−Produces
147−--------
148−
149−A boolean.
150−
151−Source
152−------
153−
154− ++ gte :: greater-equal
155− ~/ %gte
156− |= [a=@ b=@]
157− ^- ?
158− !(lth a b)
159−
160−
161−Examples
162−--------
163−
164− > (gte 100 10)
165− %.y
166− > (gte 4 4)
167− %.y
168− > (gte 3 4)
169− %.n
170−
171−
172−
173−***
174−### `++gth`
175−
176−Greater-than
177−
178−Tests whether `a` is greater than `b`.
179−
180−Accepts
181−-------
182−
183−`a` is an atom.
184−
185−`b` is an atom.
186−
187−Produces
188−--------
189−
190−A boolean.
191−
192−Source
193−------
194−
195− ++ gth :: greater-than
196− ~/ %gth
197− |= [a=@ b=@]
198− ^- ?
199− !(lte a b)
200−
201−
202−
203−Examples
204−--------
205−
206− > (gth 'd' 'c')
207− %.y
208− > (gth ~h1 ~m61)
209− %.n
210−
211−
212−
213−***
214−### `++lte`
215−
216−Less-than/equal
217−
218−Tests whether `a` is less than or equal to `b`.
219−
220−Accepts
221−-------
222−
223−`a` is an atom.
224−
225−`b` is an atom.
226−
227−Produces
228−--------
229−
230−A boolean.
231−
232−Source
233−------
234−
235− ++ lte :: less-equal
236− ~/ %lte
237− |= [a=@ b=@]
238− |(=(a b) (lth a b))
239−
240− ::
241−
242−Examples
243−--------
244−
245− > (lte 4 5)
246− %.y
247− > (lte 5 4)
248− %.n
249− > (lte 5 5)
250− %.y
251− > (lte 0 0)
252− %.y
253−
254−
255−
256−***
257−### `++lth`
258−
259−Less-than
260−
261−Tests whether `a` is less than `b`.
262−
263−Accepts
264−-------
265−
266−`a` is an atom.
267−
268−`b` is an atom.
269−
270−Produces
271−--------
272−
273−A boolean.
274−
275−Source
276−------
277−
278− ++ lth :: less-than
279− ~/ %lth
280− |= [a=@ b=@]
281− ^- ?
282− ?& !=(a b)
283− |-
284− ?| =(0 a)
285− ?& !=(0 b)
286− $(a (dec a), b (dec b))
287− == == ==
288−
289−Examples
290−--------
291−
292− > (lth 4 5)
293− %.y
294− > (lth 5 4)
295− %.n
296− > (lth 5 5)
297− %.n
298− > (lth 5 0)
299− %.n
300−
301−
302−***
303−### `++max`
304−
305−Maximum
306−
307−Computes the greater of `a` and `b`.
308−
309−Accepts
310−-------
311−
312−`a` is an atom.
313
151
314−`b` is an atom.
152+ > (div 20 30)
315−
316−Produces
317−--------
318−
319−An atom.
320−
321−Source
322−------
323−
324− ++ max :: maximum
325− ~/ %max
326− |= [a=@ b=@]
327− ^- @
328− ?: (gth a b) a
329− b
330−
331−Examples
332−--------
333−
334− > (max 10 100)
335− 100
336− > (max 10.443 9)
337− 10.443
338− > (max 0 1)
339− 1
340−
341−
342−
343−***
344−### `++min`
345−
346−Minimum
347−
348−Computes the lesser of `a` and `b`.
349−
350−Accepts
351−-------
352−
353−`a` is an atom.
354−
355−`b` is an atom.
356−
357−Produces
358−--------
359−
360−An atom.
361−
362−Source
363−------
364−
365− ++ min :: minimum
366− ~/ %min
367− |= [a=@ b=@]
368− ^- @
369− ?: (lth a b) a
370− b
371−
372−Examples
373−--------
374−
375− > (min 10 100)
376− 10
377− > (min 10.443 9)
378− 9
379− > (min 0 1)
380 0
153 0
381
154
155+ > (div 'ab' 'a')
156+ 259
157+ > `@`'ab'
158+ 25.185
159+ > `@`a
160+ 97
382
161
162+ > (div 0x9f 0x29)
163+ 6
164+ > `@`0x9f ::`0x9f` is an atom represented in the hexadecimal soft atom type (`@ux`).
165+ 159
166+ > `@`0x29
167+ 41
383
168
384−***
169+ > (div 0x29 0x9f)
385−### `++mod`
386−
387−Modulus
388−
389−Computes the remainder of dividing `a` by `b`.
390−
391−Accepts
392−-------
393−
394−`a` is an atom.
395−
396−`b` is an atom.
397−
398−Produces
399−--------
400−
401−An atom.
402−
403−Source
404−------
405−
406− ++ mod :: remainder
407− ~/ %mod
408− |: [a=`@`1 b=`@`1]
409− ^- @
410− ?< =(0 b)
411− (sub a (mul b (div a b)))
412−
413−
414−Examples
415−--------
416−
417− > (mod 5 2)
418− 1
419− > (mod 5 5)
420 0
170 0
421
171
422−
172+ > (div ~sibtel-tallyd ~zod)
423−
173+ ! exit
424−***
174+ > `@`~sibtel-tallyd
425−### `++mul`
175+ 7.303.014
426−
176+ > `@`~zod ::the above operation returned an error because `~zod` is a representation of `0`.
427−Multiply
428−
429−Multiplies `a` by `b`.
430−
431−Accepts
432−-------
433−
434−`a` is an atom.
435−
436−`b` is an atom.
437−
438−Produces
439−--------
440−
441−An atom.
442−
443−Source
444−------
445−
446− ++ mul :: multiply
447− ~/ %mul
448− |: [a=`@`1 b=`@`1]
449− ^- @
450− =+ c=0
451− |-
452− ?: =(0 a) c
453− $(a (dec a), c (add b c))
454−
455−Examples
456−--------
457−
458− > (mul 3 4)
459− 12
460− > (mul 0 1)
461 0
177 0
462
178
179+ > `@p`2 ::this casts `2` to `@p` to produce the ship name which represents that atom.
180+ ~bud
181+ > (div ~sibtel-tallyd ~bud)
182+ > 3.651.507
463
183
464
184
465***
185***
466−### `++sub`
186+### `++dvr`
467
187
468−Subtract
188+Divide with remainder
469
189
470−Subtracts `b` from `a`.
190+Computes `a` divided by `b` and the remainder of that operation.
471−
472−Accepts
473−-------
474−
475−`a` is an atom.
476−
477−`b` is an atom.
478
191
479Produces
192Produces
480−--------
481−
482−An atom.
483−
484−Source
485−------
486−
487− ++ sub :: subtract
488− ~/ %sub
489− |= [a=@ b=@]
490− ~| %subtract-underflow
491− ^- @
492− ?: =(0 b) a
493− $(a (dec a), b (dec b))
494−
495−Examples
496−--------
497−
498− > (sub 10 5)
499− 5
500− > (sub 243 44)
501− 199
502− > (sub 5 0)
503− 5
504− > (sub 0 5)
505− ! subtract-underflow
506− ! exit
507−
508−
509−
510−***
511−
512−Decrements `a` by `1`.
513−
514−Accepts
515-------
193-------
516
194
517−`a` is an atom.
195+A cell of atoms.
518−
519−Produces
520−--------
521−
522−An atom.
523
196
524Source
197Source
525------
198------
526
199
527− ++ dec :: decrement
200+ ++ dvr
528− ~/ %dec
201+ ~/ %dvr
529− |= a=@
202+ |= [a=@ b=@]
530− ~| %decrement-underflow
531− ?< =(0 a)
532− =+ b=0
533− |- ^- @
203+ ^- [p=@ q=@]
534− ?: =(a +(b)) b
204+ [(div a b) (mod a b)]
535− $(b +(b))
205+ ::
536−
537Examples
206Examples
538--------
207--------
208+ > (dvr 17 8)
209+ [p=2 q=1]
539
210
540− > (dec 7)
211+ > (dvr 17 6)
541− 6
212+ [p=2 q=5]
542− > (dec 0)
543− ! decrement-underflow
544− ! exit
545−
546
213
214+ > (dvr 18 6)
215+ [p=3 q=0]
547
216
548−***
217+ > (dvr 4 2)
549−### `++div`
218+ [p=2 q=0]
550
219
551−Divide
220+ > (dvr 'ab 'a')
221+ [p=259 q=62]
222+ > `@`'a' ::`a` is an atom represented as a different data type.
223+ 97 We can cast it to the aura `@` to see what its integer representation is.
224+ > `@`'ab'
225+ 25.185
552
226
553−Computes `a` divided by `b`.
227+ > (dvr '' 'a')
554−
228+ [p=0 q=0]
555−Accepts
556−-------
557−
558−`a` is an atom.
559−
560−`b` is an atom.
561−
562−Produces
563−--------
564−
565−An atom.
566−
567−Source
568−------
569−
570− ++ div :: divide
571− ~/ %div
572− |= [a=@ b=@]
573− ^- @
574− ~| 'div'
575− ?< =(0 b)
576− =+ c=0
577− |-
578− ?: (lth a b) c
579− $(a (sub a b), c +(c))
580− ::
581−
582−Examples
583−--------
584−
585− > (div 4 2)
586− 2
587− > (div 17 8)
588− 2
589− > (div 20 30)
590− 0
591
229
592
230
593***
231***
@@ -595,7 +233,7 @@ Examples
595
233
596Greater-than/equal
234Greater-than/equal
597
235
598−Tests whether `a` is greater than a number `b`.
236+Tests whether a number `a` is greater than or equal a number `b`.
599
237
600Accepts
238Accepts
601-------
239-------
@@ -607,28 +245,41 @@ Accepts
607Produces
245Produces
608--------
246--------
609
247
610−A boolean.
248+A flag. Our version of a boolean, except that `0` is yes/true and `1` is no/false.
611
249
612Source
250Source
613------
251------
614
252
615− ++ gte :: greater-equal
253+ ++ gte
616 ~/ %gte
254 ~/ %gte
617 |= [a=@ b=@]
255 |= [a=@ b=@]
618 ^- ?
256 ^- ?
619 !(lth a b)
257 !(lth a b)
620−
258+ ::
621−
622Examples
259Examples
623--------
260--------
624
261
625 > (gte 100 10)
262 > (gte 100 10)
626 %.y
263 %.y
264+
627 > (gte 4 4)
265 > (gte 4 4)
628 %.y
266 %.y
267+
629 > (gte 3 4)
268 > (gte 3 4)
630 %.n
269 %.n
631
270
271+ > `@`'h' ::`h` is an atom represented as a `cord`, one of many different soft atom types.
272+ 104 ::We can cast it to the mold `@` to see what its integer representation is.
273+ > `@`'b'
274+ 98
275+ > (gte 'h' 'b')
276+ %.y
277+
278+ > (gte '0xc' '0xf')
279+ %.n
280+
281+ > (gte '0xc' '0xc')
282+ %.y
632
283
633
284
634***
285***
@@ -648,27 +299,41 @@ Accepts
648Produces
299Produces
649--------
300--------
650
301
651−A boolean.
302+A flag; our version of a boolean, except that `0` is yes/true and `1` is no/false.
652
303
653Source
304Source
654------
305------
655
306
656− ++ gth :: greater-than
307+ ++ gth
657 ~/ %gth
308 ~/ %gth
658 |= [a=@ b=@]
309 |= [a=@ b=@]
659 ^- ?
310 ^- ?
660 !(lte a b)
311 !(lte a b)
661−
312+ ::
662−
663−
664Examples
313Examples
665--------
314--------
315+ > (gth 2 1)
316+ %.y
317+
318+ > (gth 1 2)
319+ %.n
666
320
667 > (gth 'd' 'c')
321 > (gth 'd' 'c')
668 %.y
322 %.y
669− > (gth ~h1 ~m61)
323+ > `@`'d' ::`d` is an atom represented as a `cord`, one of many different soft atom types.
324+ 100 ::We can cast it to the mold `@` to see what its integer representation is.
325+ > `@`'c'
326+ 99
327+
328+ > (gth 'doug' 'catherine')
670 %.n
329 %.n
330+ > `@`'doug'
331+ 1.735.749.476
332+ > `@`'catherine'
333+ 1.871.077.167.441.261.125.987
671
334
335+ > (gth ~h1 ~m61) ::~h1 and ~m61 are both relative dates. Cast an atom to `@dr` to see its representation in that soft atom type.
336+ %.n
672
337
673
338
674***
339***
@@ -688,30 +353,43 @@ Accepts
688Produces
353Produces
689--------
354--------
690
355
691−A boolean.
356+A flag; our version of a boolean, except that `0` is yes/true and `1` is no/false.
692
357
693Source
358Source
694------
359------
695
360
696− ++ lte :: less-equal
361+ ++ lte
697 ~/ %lte
362 ~/ %lte
698 |= [a=@ b=@]
363 |= [a=@ b=@]
699 |(=(a b) (lth a b))
364 |(=(a b) (lth a b))
700−
701 ::
365 ::
702−
703Examples
366Examples
704--------
367--------
705
368
706 > (lte 4 5)
369 > (lte 4 5)
707 %.y
370 %.y
371+
708 > (lte 5 4)
372 > (lte 5 4)
709 %.n
373 %.n
374+
710 > (lte 5 5)
375 > (lte 5 5)
711 %.y
376 %.y
377+
712 > (lte 0 0)
378 > (lte 0 0)
713 %.y
379 %.y
714
380
381+ > (lte 'a' 'b')
382+ %.y
383+ > `@`'a'
384+ 97
385+ > `@`'b'
386+ 98
387+
388+ > (lte 'abraham' 'bob')
389+ %.n
390+
391+ > (lte ~m61 ~h1) ::~m61 and ~h1 are both relative dates. Cast an atom to `@dr` to see its representation in that soft atom type.
392+ %.n
715
393
716
394
717***
395***
@@ -731,12 +409,12 @@ Accepts
731Produces
409Produces
732--------
410--------
733
411
734−A boolean.
412+A flag; our version of a boolean, except that `0` is yes/true and `1` is no/false.
735
413
736Source
414Source
737------
415------
738
416
739− ++ lth :: less-than
417+ ++ lth
740 ~/ %lth
418 ~/ %lth
741 |= [a=@ b=@]
419 |= [a=@ b=@]
742 ^- ?
420 ^- ?
@@ -746,19 +424,36 @@ Source
746 ?& !=(0 b)
424 ?& !=(0 b)
747 $(a (dec a), b (dec b))
425 $(a (dec a), b (dec b))
748 == == ==
426 == == ==
749−
427+ ::
750Examples
428Examples
751--------
429--------
752
430
753 > (lth 4 5)
431 > (lth 4 5)
754 %.y
432 %.y
433+
755 > (lth 5 4)
434 > (lth 5 4)
756 %.n
435 %.n
436+
757 > (lth 5 5)
437 > (lth 5 5)
758 %.n
438 %.n
439+
759 > (lth 5 0)
440 > (lth 5 0)
760 %.n
441 %.n
761
442
443+ > (lth 'a' 'b')
444+ %.y
445+ > `@`'a' ::`a` is an atom represented as a different data type.
446+ 97 ::We can cast it to the aura `@` to see what its integer representation is.
447+ > `@`'b'
448+ 98
449+
450+ > (lth 'abraham' 'bob')
451+ %.n
452+ > `@`'abraham'
453+ > 30.787.873.400.840.801
454+ > `@`'bob'
455+ > 6.451.042
456+
762
457
763***
458***
764### `++max`
459### `++max`
@@ -782,24 +477,39 @@ An atom.
782Source
477Source
783------
478------
784
479
785− ++ max :: maximum
480+ ++ max
786 ~/ %max
481 ~/ %max
787 |= [a=@ b=@]
482 |= [a=@ b=@]
788 ^- @
483 ^- @
789 ?: (gth a b) a
484 ?: (gth a b) a
790 b
485 b
791−
486+ ::
792Examples
487Examples
793--------
488--------
794
489
795 > (max 10 100)
490 > (max 10 100)
796 100
491 100
492+
797 > (max 10.443 9)
493 > (max 10.443 9)
798 10.443
494 10.443
495+
799− > (max 0 1)
496+ > (max 1 1)
800 1
497 1
801
498
499+ > (max 'abraham' 'bob')
500+ 30.787.873.400.840.801
501+
502+ > `@t`(max 'abraham' 'bob') ::`@t` displays the product as a `cord` (string) instead of a number.
503+ 'abraham'
802
504
505+ > `@t`(max 'abraham' 'benjamin')
506+ 'benjamin'
507+
508+ > `@dr`(max ~m6 ~h1) ::~m61 and ~h1 are relative dates. Cast an atom to `@dr` to see its representation in that soft atom type.
509+ ~h1
510+
511+ >`@ux`(max 0xe1 0x1e) ::`0xe1` and `0x1e` are of the hexadecimal soft atom type (`@ux`).
512+ 0xe1
803
513
804***
514***
805### `++min`
515### `++min`
@@ -823,23 +533,36 @@ An atom.
823Source
533Source
824------
534------
825
535
826− ++ min :: minimum
536+ ++ min
827 ~/ %min
537 ~/ %min
828 |= [a=@ b=@]
538 |= [a=@ b=@]
829 ^- @
539 ^- @
830 ?: (lth a b) a
540 ?: (lth a b) a
831 b
541 b
832−
542+ ::
833Examples
543Examples
834--------
544--------
835
545
836 > (min 10 100)
546 > (min 10 100)
837 10
547 10
548+
838 > (min 10.443 9)
549 > (min 10.443 9)
839 9
550 9
840− > (min 0 1)
841− 0
842
551
552+ > (min 1 1)
553+ 1
554+
555+ > (min 'abraham' 'bob')
556+ 6.451.042
557+
558+ > `@t`(min 'abraham' 'bob') ::`@t` causes the product to display as a `cord` instead of a number.
559+ 'bob'
560+
561+ > `@t`(min 'abraham' 'benjamin')
562+ 'abraham'
563+
564+ > `@dr`(min ~m6 ~h1) ::~m61 and ~h1 are relative dates. Cast an atom to `@dr` to see its representation in that soft atom type.
565+ ~m6
843
566
844
567
845***
568***
@@ -864,22 +587,39 @@ An atom.
864Source
587Source
865------
588------
866
589
867− ++ mod :: remainder
590+ ++ mod
868 ~/ %mod
591 ~/ %mod
869 |: [a=`@`1 b=`@`1]
592 |: [a=`@`1 b=`@`1]
870 ^- @
593 ^- @
871 ?< =(0 b)
594 ?< =(0 b)
872 (sub a (mul b (div a b)))
595 (sub a (mul b (div a b)))
873−
596+ ::
874−
875Examples
597Examples
876--------
598--------
877
599
878 > (mod 5 2)
600 > (mod 5 2)
879 1
601 1
602+
880 > (mod 5 5)
603 > (mod 5 5)
881 0
604 0
882
605
606+ > (mod 2 5)
607+ 2
608+
609+ > (mod 40 20)
610+ 0
611+
612+ > `@`'c' ::`a` is an atom represented as a different data type.
613+ 99 ::We can cast it to the aura `@` to see what its integer representation is.
614+ >`@`'a'
615+ 97
616+ > (mod 'c' 'a')
617+ 2
618+
619+ > (mod 0xe1 0x1e) ::`0xe1` and `0x1e` are of the hexadecimal soft atom type (`@ux`).
620+ 15
621+ > `@ux`(mod 0xe1 0x1e)
622+ 0xf
883
623
884
624
885***
625***
@@ -904,7 +644,7 @@ An atom.
904Source
644Source
905------
645------
906
646
907− ++ mul :: multiply
647+ ++ mul
908 ~/ %mul
648 ~/ %mul
909 |: [a=`@`1 b=`@`1]
649 |: [a=`@`1 b=`@`1]
910 ^- @
650 ^- @
@@ -912,15 +652,27 @@ Source
912 |-
652 |-
913 ?: =(0 a) c
653 ?: =(0 a) c
914 $(a (dec a), c (add b c))
654 $(a (dec a), c (add b c))
915−
655+ ::
916Examples
656Examples
917--------
657--------
918
658
919 > (mul 3 4)
659 > (mul 3 4)
920− 12
660+ 12
661+
921− > (mul 0 1)
662+ > (mul 0 1)
922 0
663 0
923
664
665+ > `@`'a' ::`a` is an atom represented as a different data type.
666+ 97 ::We can cast it to the aura `@` to see what its integer representation is.
667+ > `@`'b'
668+ 98
669+ > (mul 'a' 'b')
670+ 9.506
671+
672+ > (mul 0x1f 0xe) ::`0x1f` and `0xe` are of the hexadecimal soft atom type (`@ux`).
673+ 424
674+ >`@ux`(mul 0x1f 0xe)
675+ 0x1b2
924
676
925
677
926***
678***
@@ -945,27 +697,41 @@ An atom.
945Source
697Source
946------
698------
947
699
948− ++ sub :: subtract
700+ ++ sub
949− ~/ %sub
701+ ~/ %sub
950− |= [a=@ b=@]
702+ |= [a=@ b=@]
951− ~| %subtract-underflow
703+ ~| %subtract-underflow
952− ^- @
704+ ^- @
953− ?: =(0 b) a
705+ ?: =(0 b) a
954− $(a (dec a), b (dec b))
706+ $(a (dec a), b (dec b))
955−
707+ ::
956Examples
708Examples
957--------
709--------
958
710
959 > (sub 10 5)
711 > (sub 10 5)
960 5
712 5
713+
961 > (sub 243 44)
714 > (sub 243 44)
962 199
715 199
716+
963 > (sub 5 0)
717 > (sub 5 0)
964 5
718 5
719+
965 > (sub 0 5)
720 > (sub 0 5)
966 ! subtract-underflow
721 ! subtract-underflow
967 ! exit
722 ! exit
968
723
724+ > (sub 'c' 'a')
725+ 2
726+ > `@`'c' ::`a` is an atom represented as a different data type.
727+ 99 ::We can cast it to the aura `@` to see what its integer representation is.
728+ > `@`'a'
729+ 97
730+
731+ > (sub 0x1f 0xe)
732+ 17
733+ > `@ux`(sub 0x1f 0xe) ::`0xe1` and `0x1e` are of the hexadecimal soft atom type (`@ux`).
734+ 0x11
969
735
970
736
971***
737***