Examples

Here you will find some example krill programs.

Date and time

(map toNumber . split "-" . date) ()
# => [2019,5,11]

(map toNumber . split ":" . time) ()
# => [17,40]

File I/O

writeFile "/var/tmp/foo" "hello world"

readFile "/var/tmp/foo"
# => "hello world"

appendFile "/var/tmp/foo" "\nhow are you?"

readFile "/var/tmp/foo"
# => hello world
# => how are you?

Factorial

fac = n -> {
  if n == 0 then 1
  else n * (fac $ n - 1)
}

Fibonacci

fib = n -> {
  if n == 0 then 0
  else {
   if n == 1 then 1
   else fib (n - 1) + fib (n - 2)
  }
}