At Tue, 17 Jun 2014 19:38:58 -0700,
Timothy Beyer wrote:
> I'd rather write something like the following (assuming that arguments are
> treated as a tuple of values):
>
> fun mapX [a] (f : (unit -> list a) -> a -> xbody) (ls : list a) : xbody =
> let
> fun mapX' (ls, acc) =
> ([], _) => <xml/>
> | (x :: ls, _) => <xml>{f (fn () => List.revAppend acc ls) x}{mapX'
> (ls, (x :: acc))}</xml>
> in
> mapX' (ls, [])
> end
>
Alternatively, is something like the code below possible?
fun mapX [a] (f : (unit -> list a) -> a -> xbody) (ls : list a) : xbody =
let
fun mapX' ls acc =
| mapX' [] _ = <xml/>
| mapX' (x :: ls) _ = <xml>{f (fn () => List.revAppend acc ls)
x}{mapX' ls (x :: acc)}</xml>
in
mapX' ls []
end
Regards,
Tim
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur