Hi Alex,
> (let (Clr "#EEE" Cls "xxx")
> (fill
> '(html
> (body (style "background-color:" Clr)
> (div (class Cls)) ) )
> '(Clr Cls) ) )
One problem with 'fill' is that the expressions to fill cannot be
anonymous (it must be the result of a variable), e.g. to fill the
result of (pack "#" "EEE"), we must (setq Clr (pack "#" "EEE")) first
before using 'fill'.
> But why should this be necessary, if 'html' and such functions could handle
> their arguments in the normal way?
> (out "t.html"
> (let (Clr "#EEE" Cls "xxx")
> (html 0 "Title" "lib.css" (cons "background-color" Clr)
> (<div> Cls
> "Something in the DIV" ) ) ) )
That's true if such functions (e.g. <div>, <ul>, ...) already exist.
If not, we must create them (and be bloated?), or create a generic
function (e.g. <tag>), which must be the case if "tag names" can be
anything, like in XML, unlike HTML/XHTML, where tag names are limited.
But with that, the code does not "look nice" any more, compare:
(html ....
(<tag> 'div NIL
(<tag> 'ul NIL
(<tag> 'li NIL ...)
... )))
with
(html ....
'(div NIL
(ul NIL
(li NIL ...)
... )))
Best regards,
KS
On 5/8/09, Alexander Burger <[email protected]> wrote:
> Hi Kriangkrai,
>
>> It would be great if PicoLisp have "quasi-quotation", so the code
>> could be something like:
>>
>> (out "t.html"
>> (sxml
>> (let (Clr "#EEE" Cls "xxx")
>> `(html
>> (body (@ style "background-color:" ,Clr)
>> (div (@ class ,Cls)) )))))
>
> There is indeed something simlar, though not on the base of read
> macros but of a function ('fill'). You can either write
>
> (let (Clr "#EEE" Cls "xxx")
> (fill
> '(html
> (body (style "background-color:" Clr)
> (div (class Cls)) ) )
> '(Clr Cls) ) )
>
> or use pattern variables (with '@')
>
> (let (@Clr "#EEE" @Cls "xxx")
> (fill
> '(html
> (body (style "background-color:" @Clr)
> (div (class @Cls)) ) ) ) )
>
>
> But why should this be necessary, if 'html' and such functions
> could handle their arguments in the normal way? A real working
> example would be
>
> (load "lib/http.l" "lib/xhtml.l")
>
> (out "t.html"
> (let (Clr "#EEE" Cls "xxx")
> (html 0 "Title" "lib.css" (cons "background-color" Clr)
> (<div> Cls
> "Something in the DIV" ) ) ) )
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe
>
--
UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe