Hi Bruno,

> I'm going through the picolisp application development tutorial (
> http://software-lab.de/doc/app.html#tags) and I'm trying this piece of code
> at the tags section:
> : (<div> 'main
>    (<h1> NIL "Head")
>    (<p> NIL
>       (<br> "Line 1")
>       "Line"
>       (<nbsp>)
>       (+ 1 1) ) )
> <div class="main"><h1>Head</h1>
> <p>Line 1<br/>
> Line&nbsp;</p>
> </div>
> That is, the (+ 1 1) part is not evaluated.

In fact it *is* evaluated, but it does not print anything.

All those HTML functions are *print* front-ends, which send text to the current
output channel.

   : (<h1> NIL "Head")

is nothing more than

   : (prinl "<h1>Head</h1>")

just in a more convenient form.

The nice thing is that these functions may be nested, as can be seen in your
example (<div> 'main (<h1> NIL "Head") ..). Still they must print somewhere at
the bottom.

So the answer to your question is to write

   (ht:Prin (+ 1 1))

or just

   (prin (+ 1 1))

('ht:Prin' is recommended for textual data which may contain HTML meta 
to properly escape them)

Note that - for convenience - *atomic* expressions (like "Head" or "Line" in
your example) are printed directly, so that it is not necessary to write

   (<h1> NIL (prin "Head"))  # Not needed

This is also mentioned in doc/app.html as

   • If an argument is an atom (a number or a symbol (string)), its value is
     printed immediately.

   • Otherwise (a list), it is evaluated as a Lisp function (typically some form
     of print statement).

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to