Veduz Language

[Design notes, not implemented yet]

Expressions:

  • Block/function { argNames.. | body.. }
  • Pure method invocation obj.method( args.. )
  • Type val:type
  • Binding name = value
  • Variable name
  • Number literal 123
  • String literal "foo"

Initial types: Num, String, Dict, Vec, Bool, Nil

fib = {n:Int |
 n.<(2)
 .then-else(
  {1}
  {fib.(n.-(1)).+(fib.(n.-(2)))})}
sieve = {n:Int | 
 n.<=(2)
 .then-else(
  {Dict}
  {max = n:Num.sqrt()
   sieve.(n.-(1))
   .takeWhile({i:Int |i.<=(max)}) 
   .find({i:Int |n.mod(i).=(0)})
   .then-else({d.+(n)} {d}):Int})}
state.def_method(
 Vec 
 "find"
 {v:Iterable f:Fn |
  v.empty().then-else(
   {nil}
   {first = v.first()
    f.(first).then-else({first} v.rest().find(f))})})