The disadvantage of gensym'd symbols is that the code is more difficult
to understand when pretty printed, and cannot be written to some file
and retrieved later.
True.
The PicoLisp solution of transient symbols has an identical effect
(especially if you surround the function definition(s)
On Wed, Oct 22, 2008 at 04:47:36PM +0100, Tomas Hlavaty wrote:
(de foo Prg
(let At (up @)
(when (car Prg)
(let @ At
(run (cdr Prg))
: (and 2 (foo T (+ 1 @ 3)))
- 6
Yep. In that case, you can even omit the 'up', as '@' is not modified
yet. And the 'let's
Up until now, the simplest (and recommended, I think) version was:
(de foo Prg
(when (car Prg)
(run (cdr Prg) 1) ) )
Well, I think this version has one important limitation: if Prg has a
recursive call(s) to foo, the deeper foo won't see any values set by
the foo above, or
Hi Alex and Jon,
Indenting is impossible to do well I think because the function does
not know what is going to happen in the body (the 'xml' function knows
I think so, too. This is also the reason why the functions in
lib/xhtml.l don't do any efforts to indent. And with this xml
function
Hi Tomas,
maybe it could become part of lib/xml.l? I would use it as it looks
more convenient than building list for 'xml' function in some cases.
I'm not sure. It might be convenient, but it makes 'xml' asymmetrical.
Are you thinking of a separate 'xml' function? It should be tried in
Hi Alex,
Hi Jon,
The test (if (car Lst) ... determines whether the current element is a
container (hoy) or not (inner).
Is the 'car' necessary? Otherwise a simple test of 'Lst' would suffice.
No, it seems to work quite well without the 'car'. ;-)
BTW, I always feel that a 'prog' is a
Hi Jon,
then the calls would very often have a lot of NIL arguments, which looks
rather ugly. Should I switch to property lists? Any suggestions?
How about the following?
(de text Prg
(prin text)
(while (atom (car Prg))
(prin (pop 'Prg) =\ (eval (pop 'Prg) 1) \) )
How about the following?
(de text Prg
(prin text)
(while (atom (car Prg))
(prin (pop 'Prg) =\ (eval (pop 'Prg) 1) \) )
(prin )
(run Prg) # the text, or other elements
(prinl /text) )
Then you could write
: (text id 123 dx (+ 3 4)