Play

Check-in [a327035cc3]
Login
Overview
Comment:Added Pair/2-Tuple data structure.
Timelines: family | ancestors | descendants | both | stdlib
Files: files | file ages | folders
SHA3-256: a327035cc3dc538ccfdcec7d5022dd2c12cc61622e36c739c1c115397724ab75
User & Date: robin.hansen on 2021-04-09 07:37:57
Other Links: branch diff | manifest | tags
Context
2021-04-09
08:08
Added List data structure. The implementation of fold revealed several bugs in the compiler. check-in: 744a763bab user: robin.hansen tags: stdlib
07:37
Added Pair/2-Tuple data structure. check-in: a327035cc3 user: robin.hansen tags: stdlib
2021-04-08
14:29
Add maybe module. check-in: b568971705 user: robin.hansen tags: stdlib
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified stdlib/play.json from [3afdc904a2] to [8dbe1d2071].

1
2
3
4
5
6
7

8
9
10
11
{
    "name": "play/standard_library",
    "version": "0.2.0",
    "language-version": "0.2.0",
    "exposed-modules": [
        "core",
        "maybe"

    ],
    "dependencies": {},
    "package-paths": []
}






|
>




1
2
3
4
5
6
7
8
9
10
11
12
{
    "name": "play/standard_library",
    "version": "0.2.0",
    "language-version": "0.2.0",
    "exposed-modules": [
        "core",
        "maybe",
        "pair"
    ],
    "dependencies": {},
    "package-paths": []
}

Added stdlib/src/pair.play version [0056df763e].







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
defstruct: Pair a b
: first a
: second b

def: spill
type: (Pair a b) -- a b
: [ first> ] [ second> ] core/split

def: map
type: (Pair a b) [ a b -- c d ] -- (Pair c d)
: swap spill -rotate ! >Pair

def: map-first
type: (Pair a b) [ a -- c ] -- (Pair c b)
: core/over first> swap ! >first

def: map-second
type: (Pair a b) [ b -- c ] -- (Pair a c)
: core/over second> swap ! >second