On Sat, Mar 13, 2021 at 2:05 PM Alexander Burger <a...@software-lab.de> wrote:
> > Yes. (And strings are always immutable in PicoLisp anyway) > this is pretty interesting to be rembered, good for newbies to discover why it is that way ;-) > > : (de pp P (prin "<p>") (run P) (prin "</p>") (pack "<p>" (run P) > "</p>") ) > > This is a bit problematic, because the body in P is executed twice. Not > only is > this slower, but may create havoc because in a typical GUI program *all* > logic > happens in these bodies. This logic would be executed several times, doing > lots > of unexpecyed things. Better then: > > (de pp P > (prin (pack "<p>" (run P) "</p>")) ) > > yes, all my examples in my previous email are bad code, just for output only, trying to offer examples of how things can go weird They're are not intended to be right implementations, too bad for that ;-) > For such a simple example it works. But keep in mind that typically 'P' > is a large program, with lots of 'if's, 'while's and arbitrarily deeply > nested other HTML tags. > > yes sure, I think the PilCon and this email thread are good examples of an interesting use of fexprs but even complex and large programs may be arranged in a way fexpr are not needed, it's a kind of condig style. My point is you can do with fexprs everything you do with exprs but the opposite is not true, fexprs have it own role in lisp. But I prefer to code in a more functional style working composing functions with inmutable objects and without side-effects. It's always a balance between performance and logical beauty (from my point of view), but performance is not only about computing performarce but also logic and conceptual performarce and even profiling or debugging performance. At the end the smart decision is to choose the better tool for the job ;-) greets