On Thu, 2006-10-05 at 14:33 +1000, Jonathan Kelly - LNA wrote:
> Can't you do this?
>
> fun map[T,U] (f:T->U) (x:list[T]) =>
> match x with
> | Empty[T] => Empty[U]
> | Cons(?h, ?t) => {
> print "hello"; endl;
> return Cons(_f h, map f x)
> }
> endmatch
> ;
No, because the type of the first branch is list[U],
but the type of the second branch is
unit -> list[U]
you would have to do this:
fun map[T,U] (f:T->U) (x:list[T]) =>
match x with
| Empty[T] => Empty[U]
| Cons(?h, ?t) => {
print "hello"; endl;
return Cons(_f h, map f x);
} ()
endmatch
;
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language