> > Note Felix lacks a way to say > > let fun aux ... > in aux ... > > which would avoid the procedural form = { ... return .. } above
Now implemented. fun to_assoc_list3[T] (l:list[T]):list[T^2] => let fun aux (l:list[T]) (tmp:list[T^2]) => match l with | Empty => rev tmp | ?k ! ?v ! ?tl => aux tl ( (k,v) ! tmp ) endmatch in aux l Empty[T^2] ; Much nicer. Only works for "fun" at the moment. Note there is a procedural equivalent: with whatever do something done This is the same as just whatever then something except definitions in whatever are hidden after the done (and, you cannot exit the definitions!) Because of the way I implemented it, it seems possible to generalise the let form above to let whatever in expr barring syntactic ambiguities. For example let var x = 1; var y = x + 1; in y + 1 The implementation of this would be: # { var x = 1; var y = x + 1; return y + 1; } Note the "let fun" syntax would conflict with this, we'd have to use let fun aux (l:list[T]) (tmp:list[T^2]) => match l with | Empty => rev tmp | ?k ! ?v ! ?tl => aux tl ( (k,v) ! tmp ) endmatch; in aux l Empty[T^2] which differs from what I implemented by a semi-colon :) i may do this if possible, since it is much more general if a bit ugly .. let var x = 1; in ... Uggh. Hmmm. Of course you can already do this with #{ var x = 1; var y = x + 1; y + 1 } AND #{ var x = 1; var y = x + 1; return y + 1; } since the former means the latter. Note: Felix syntax seems a bit messy. Why? Because Felix tries to provide everything with two different syntaxen: functional and imperative. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language