[Ur] An Ur/Web implementation of TodoMVC
Timothy Beyer
beyert at fastmail.net
Tue Jun 17 23:13:22 EDT 2014
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
More information about the Ur
mailing list