Our favorite features

image
image

.oil extensions


                    +-- yarn.lock
+-- Extracts
+   +-- corn.oil
+   +-- truffle.oil
+   +-- olive.oil
image

Stylish comments


                  | Have you ever seen such
| stylish comments?

| ...
| We didn't think so
image

Types


                    | built in matrix support
A, B := [0, 4 ,5], [[3], [7]]

| and something we call ranges
evens = [0:2:10)

Some other features...

Variable Declarations


              | immutable
x = 2.5
| mutable
y := 2.3

Built in Constants


              print(e)
| 2.71828182845...
print(pi)
| 3.14159265359...

Yes, divmod is /%


                integer_division = 7 // 2
modulus = 7 % 2
(div, mod) = 7 /% 2

Sets and Dictionaries


                    color = {'r': 0, 'g': 12, 'b': -3}
friends = {'mom'}

Matrix and Tuples


                      stuff = (True, 'yo', 10)
W = [[0, 1, 1], [0, 0, 1], [0, 0, 1]]
v = [1, 2, 3, 4]

String interpolation


                        greeting = 'hello'
name = 'olive'
print(`${greeting}, ${name}`)

Functions


                  pun: number -> string
pun (x) =
  return 'pun'

Type Annotations


                  eval_mod: (number -> number), number -> number
eval_mod (x, y) =
  return x(y % 10)

Type Variables


                    eval_mistery: (number -> _), number -> _
eval_mistery (x, y) =
  return x(y)

If


                so = False
if (so)
  print('please')
else
  print('dont')

For


                  for i in [0:1:10)
  print(i)

W = [[1, 2, 3],[4, 5, 6]]
for row in W
  print(max(row))

While


                  i := 10
while (i >= 0)
  print(i)
  i := i - 1 | you should not do this...