I want to do this but I can't:

fun f (i:int) => 
  let fun g (x:int) => i + x in
 g (i+2)
;

I have to go to statement form:

fun f (i:int) =
{
  fun g(x:int) => i + x;
  return g(i+2);
}

That's a pain. Ocaml can do this because let introduces a function:

        let x = 1 in
        let f y = y + 1 in
        ...

In Felix you can do this:

fun f(i:int) =>
  let ?g = fun (x:int) => i + x in
  g (i+2)
;

but this is not the same: it makes g a closure. Closure can only
be inlined away with data flow analysis, it may happen in this case
but I wouldn't bet on it :)


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to