There's a fun problem with fold: I tried to do this:

fold_left join of (string * string) "" dirlist

and it failed .. I had this:

fun join(x:string, y:string)=>x + "/" + y;

but actually fold requires this:

fun join(x:string) (y:string)=> x + "/" + y;

The *problem* here is that the signature is now

join of (string)

which isn't a convenient binary operator ... also, there's a good
chance there are several binary operators with the first component,
and if we curry them then there's no way to identify the functions
(since the second argument is actually part of the return type).

During overload resolution when the function is applied, the algorithm
can pick the right function based on the return type which is actually

join: string -> (string -> string)

The bottom line is .. it might be useful to have a version of fold that
uses a product, since that's the preferred form in Felix (unlike Ocaml).

The *problem* is that it would be confusing to overload these two folds..
and may lead to an ambiguity .. so any new fold would have to have
a distinct name I think.. ;(


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to