[Ur] Generating XML
Adam Chlipala
adamc at impredicative.com
Tue Sep 15 11:47:11 EDT 2009
gdp3 at cs.waikato.ac.nz wrote:
> My initial (non-compiling) attempts were something along the lines of:
>
> fun list2p s =
> case s of Nil => <xml/>
> | (h::t) => <xml><p>{[h]}</p>{[list2p t]}</xml>
>
You should change {[list2p t]} to {list2p t}, since this is a piece of
XML, not a value of another type that must be _converted_ to XML. Also,
you'll get compiler errors about undetermined type variables (or
something related) if the later context of use of 'list2p' doesn't
determine which tag the output of your function belongs inside.
BTW, most of this logic is already implemented in the standard library
as a higher-order function. See List.mapX.
More information about the Ur
mailing list