[Ur] Hamlet like XML, structured by indentation with tag autoclosing

Gabriel Riba gabriel at xarxaire.com
Sat Jun 20 06:34:43 EDT 2015


El 18/06/15 a les 20:12, Sergey Mironov ha escrit:
> Off-topic: The interesting thing to think about is a _monadic_
> anti-quotations. For example, imagine the code
>
> return <xml><div>{| queryX(SELECT * FROM t) (fn x=> return
> <xml>{[x.A]}</xml>) |}</div></xml>
>
> desugaring into the
>
> tmp <- queryX(SELECT * FROM t) (fn x=> return <xml>{[x.A]}</xml>);
> return <xml><div>{tmp}</div></xml>
>
> Here we see clean task handled by the optimizer: selecting the name of
> temporary variable ([tmp] in this case) for us.
>
> Regards,
> Sergey
>
>
> 2015-06-18 19:29 GMT+03:00 Adam Chlipala <adamc at csail.mit.edu>:
>> On 06/18/2015 12:09 PM, Gabriel Riba wrote:
>>>
>>> (* --- with hamlet like style --- *)
>>>
>>> fun mymodule items = <ixml>
>>>
>>>     <h3> title
>>>     <div>
>>>        $if {null items}
>>>           <p> Sorry, no items left
>>>        $else
>>>           <ul>
>>>              $forall {item} <- {items}
>>>                 <li> <b>{[item]}</b>
>>> </ixml>


I am not following the antiquotations model exactly 
(http://www.smlnj.org/doc/quote.html).

Instead of antiquote variables, a place-holder for argument pattern can 
give the user the freedom to specify the pattern they want.

$foldmap {items_expr} <| {item_pattern}

     item_subtree {item_variable}




More information about the Ur mailing list