Builtin types

Booleans

True False

Integers

1 -42 100012020202

Floats

2.02020330 -0.0000000001

Strings

"I am string"

"""
I a
             m
       multiline string
"""

Symbols

#atomic_string_created_onLyOnce

Tuples

// Tuples are always created inside parens, so you can't write just 1,2,3
() (1,) (1,2,3)

Lists

[] [1] [1,2,3] 1::2::3::[]

Maps

{} {x=1} {x=1, y=(2,3), z=f(), (1+1)=(fun()=1)}

Functions

fun add3 (x, y, z) = x + y + z
fun (a, b) = a not b
// lambdas
(x, y, z) -> x + y + z
// equivalent to single element tuple (x,) -> x
x -> x
// tuple from tuple
((x,y,z),) -> x + y + z

Intefaces and generic functions

// following code  will create interface Num
// and generic functions -, +, *, /, mod, negate
interface Num(I) =
    -(I, I)
    +(I, I)
    *(I, I)
    /(I, I)
    mod(I, I)
    // unary -
    negate(I)

Types

// Abstract singleton type without ability to create instances
type None
type Bool
type True is Bool
type False is Bool
//record type
type Vec2(x,y)
type Vec3 is Vec2(...Vec2, z)

Records

// Records are instances of record types
// To create instance use type like a function
let v2 = Vec2(1, 2)
let v3 = Vec3(1, 2, 4)