plow-technologies / inferno

A statically-typed functional scripting language
MIT License
4 stars 1 forks source link

Add some tuple and fn comp primitives again #87

Closed siddharth-krishna closed 1 year ago

siddharth-krishna commented 1 year ago

This PR adds some (long awaited) primitives to Inferno, again. :)

See #81 #84

// Function composition with `<<`, `.` creates parsing issues
assert Array.map ((Text.append "a") << (Text.append "b")) ["0", "1"] == ["ab0", "ab1"] in
// Pipe operator `|>`
assert "0" |> Text.append "a" |> Text.append "b" == "ba0" in
// Some tuple stuff:
assert fst (1, 0) == snd (0, 1) in
assert zip [1, 2, 3] [4, 5] == [(1, 4), (2, 5)] in
assert zip [1, 2] ["a", "b"] == [(1,"a"),(2,"b")] in
assert zip [1] ["a", "b"] == [(1,"a")] in
assert zip [1, 2] ["a"] == [(1,"a")] in
assert zip [] [1, 2] == [] in
assert zip [1, 2] [] == [] in
0