lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 12/4/06, Gavin Wraith <> wrote:
RiscLua permits the abbreviation "\(x) => foobar end".

This solves the problem of "Lua syntax makes lambdas so painfull to write that you tend to avoid them", but it doesn't solve Enrico's currying issue ( for that, you need either a specific currying syntax, or a lambda syntax which is right-associative, so takes an _expression_ as its last element. The "end" gets in the way:

\x.\y.\z.(x z) (y z) -- lambda calculus
  --metalua--> |x||y||z| x(z)(y(z))  -- associative syntax
  --haskell--> \x->\y->\z-> (x z) (y z) -- associative syntax
  --ocaml--> fun x y z -> (x z) (y z)  (* ad-hoc syntax sugar *)
  --risclua--> \(x)=>\(x)=>\(x)=>x(z)(y(z)) end end end -- need to take care of nesting

Unless I missed something, you don't need that final "end" to keep your syntax unambiguous. Moreover, "end" is a block terminator in Lua, not an _expression_ terminator.