Overview
Comment: | Add number functions. |
---|---|
Timelines: | family | ancestors | descendants | both | stdlib |
Files: | files | file ages | folders |
SHA3-256: |
9354cf132114370d3c6137ccc35ec033 |
User & Date: | robin.hansen on 2021-04-08 14:20:28 |
Other Links: | branch diff | manifest | tags |
Context
2021-04-08
| ||
14:29 | Add maybe module. check-in: b568971705 user: robin.hansen tags: stdlib | |
14:20 | Add number functions. check-in: 9354cf1321 user: robin.hansen tags: stdlib | |
14:08 | Add helper function to perform two quotations on a single value. check-in: fd3d3efaf8 user: robin.hansen tags: stdlib | |
Changes
Modified stdlib/src/core.play from [ef80af9fad] to [b4257695bb].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
59
60
61
62
63
64
65
|
# Everything in core is imported into every module outside the standard library def: test : 4 [ 1 + ] [ 1 + ] split int= [ 10 ] [ 20 ] if # booleans defunion: Bool : True : False defstruct: True defstruct: False defmulti: zero? type: Int -- Bool : Int( value 0 ) drop True : Int drop False def: int= type: Int Int -- Bool : - zero? defmulti: not type: Bool -- Bool : True drop False : False drop True ................................................................................ type: a [ a -- b ] [ a -- c ] -- b c : -rotate dup # [] [] a a -rotate ! # [] a c swap -rotate # c a [] ! # c b swap |
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# Everything in core is imported into every module outside the standard library # booleans defunion: Bool : True : False defstruct: True defstruct: False defmulti: not type: Bool -- Bool : True drop False : False drop True ................................................................................ type: a [ a -- b ] [ a -- c ] -- b c : -rotate dup # [] [] a a -rotate ! # [] a c swap -rotate # c a [] ! # c b swap # numbers defmulti: zero? type: Int -- Bool : Int( value 0 ) drop True : Int drop False def: int= type: Int Int -- Bool : - zero? def: negate type: Int -- Int : dup dup - swap - def: square type: Int -- Int : dup * def: inc type: Int -- Int : 1 + def: dec type: Int -- Int : 1 - |