Hi Kriangkrai (what is your short name?).

This is a matter of taste, I actually like the <func> way because that
makes it easy for me to differentiate them from system functions.

Check out the xhtml.l file for both those functions and the tag function.

/Henrik

On Fri, May 8, 2009 at 3:24 PM, Kriangkrai Soatthiyanont
<kks...@gmail.com> wrote:
> Hi Alex,
>
>> (let (Clr "#EEE" Cls "xxx")
>> =A0 =A0(fill
>> =A0 =A0 =A0 '(html
>> =A0 =A0 =A0 =A0 =A0(body (style "background-color:" Clr)
>> =A0 =A0 =A0 =A0 =A0 =A0 (div (class Cls)) ) )
>> =A0 =A0 =A0 '(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 han=
dle their arguments in the normal way?
>> (out "t.html"
>> =A0 =A0(let (Clr "#EEE" =A0Cls "xxx")
>> =A0 =A0 =A0 (html 0 "Title" "lib.css" (cons "background-color" Clr)
>> =A0 =A0 =A0 =A0 =A0(<div> Cls
>> =A0 =A0 =A0 =A0 =A0 =A0 "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:
>
> =A0 (html ....
> =A0 =A0 =A0(<tag> 'div NIL
> =A0 =A0 =A0 =A0 (<tag> 'ul NIL
> =A0 =A0 =A0 =A0 =A0 =A0(<tag> 'li NIL ...)
> =A0 =A0 =A0 =A0 =A0 =A0... )))
>
> with
>
> =A0 (html ....
> =A0 =A0 =A0'(div NIL
> =A0 =A0 =A0 =A0 (ul NIL
> =A0 =A0 =A0 =A0 =A0 =A0(li NIL ...)
> =A0 =A0 =A0 =A0 =A0 =A0... )))
>
>
> Best regards,
> KS
>
>
> On 5/8/09, Alexander Burger <a...@software-lab.de> wrote:
>> Hi Kriangkrai,
>>
>>> It would be great if PicoLisp have "quasi-quotation", so the code
>>> could be something like:
>>>
>>> (out "t.html"
>>> =A0 =A0(sxml
>>> =A0 =A0 =A0 (let (Clr "#EEE" Cls "xxx")
>>> =A0 =A0 =A0 =A0 =A0`(html
>>> =A0 =A0 =A0 =A0 =A0 =A0 (body (@ style "background-color:" ,Clr)
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(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
>>
>> =A0 =A0(let (Clr "#EEE" Cls "xxx")
>> =A0 =A0 =A0 (fill
>> =A0 =A0 =A0 =A0 =A0'(html
>> =A0 =A0 =A0 =A0 =A0 =A0 (body (style "background-color:" Clr)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(div (class Cls)) ) )
>> =A0 =A0 =A0 =A0 =A0'(Clr Cls) ) )
>>
>> or use pattern variables (with '@')
>>
>> =A0 =A0(let (@Clr "#EEE" @Cls "xxx")
>> =A0 =A0 =A0 (fill
>> =A0 =A0 =A0 =A0 =A0'(html
>> =A0 =A0 =A0 =A0 =A0 =A0 (body (style "background-color:" @Clr)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(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
>>
>> =A0 =A0(load "lib/http.l" "lib/xhtml.l")
>>
>> =A0 =A0(out "t.html"
>> =A0 =A0 =A0 (let (Clr "#EEE" =A0Cls "xxx")
>> =A0 =A0 =A0 =A0 =A0(html 0 "Title" "lib.css" (cons "background-color" Cl=
r)
>> =A0 =A0 =A0 =A0 =A0 =A0 (<div> Cls
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Something in the DIV" ) ) ) )
>>
>> Cheers,
>> - Alex
>> --
>> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>>
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to