Created
February 16, 2017 04:09
-
-
Save gabejohnson/d9cf44cb8edd8885e026fb7e3987251a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const t = Table.of({a:1, b:2, c:3}); | |
const t2 = Table.of({a:4, d:5}); | |
const t3 = t.concat(t2).concat(Table.empty()); | |
t3 // Table {a: 4, b: 2, c: 3, d: 5} | |
t3.head() // Object {a: 4, d: 5} | |
t3.tail() // Table {a: 1, b: 2, c: 3} | |
t3.append({b:6, e:7}) // Table {a: 4, b: 6, c: 3, d: 5, e: 7} | |
t3.reduce(x => x * x) // Object {a: 16, b: 4, c: 9, d: 25} | |
Table.empty().alt(t3) // t3 | |
t3.get('a') // 4 | |
t3.set('a', 8) // Table {a: 8, b: 2, c: 3, d: 5} | |
Table.of(5) // Table(5) | |
Table.of(x => x) // Table(x => x) | |
t3.concat(Table.of(5)) // Table {a: 4, b: 2, c: 3, d: 5, [Symbol(value)]: 5} | |
Table.of(x => x * x).ap(t3) // Table {a: 16, b: 4, c: 9, d: 25} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment