by Justin Collins
Little language for people who don't like to be told what to do.

Brat is a little toy language that just doesn't care.

Brat code is compiled to Lua and runs on LuaJIT.

Brat is flexible enough that you can get by with a very small core and write any functionality that most languages use keywords for.

Features:

  • Typeless, and pretty much classless
  • Everything is object, except functions
  • And functions are closures, which can be attached to objects to make methods
  • Objects use a prototyping system and are completely open
  • Very flexible unary and binary operators
  • Tail calls are optimized to make infinite loops faster (and more infinite)
  • Optimized for LuaJIT tracing
#* http://rosettacode.org/wiki/Functional_Composition
  Create a function which works like: compose(f, g) (x) = f(g(x))
*#

compose = { f, g | { x | f g x } }

#Test it out
add1 = { x | x + 1 }
double = { x | x * 2 }
b = compose(->double ->add1)

p b 1 #should print 4
Information updated 07/01/13
View Comments