http://www.perlmonks.org?node_id=82924


in reply to Re: Re (tilly) 1: Lisp is More Evaluatable
in thread Lisp is More Evaluatable

Perhaps "bad style" is too strongly put.

But it is certainly considered good style to avoid side-effects. And the advice of thinking of setq as having a penalty associated is straight from On Lisp by Graham. It is not a religious rule. But it is worth thinking about. In fact I think about it in Perl as well, though I am not as extreme because Perl cannot optimize tail recursion.

As for the other point, perhaps I was unclearly verbose. But that is exactly what I was getting at with the phrase "...should no longer affect the value of z."

Replies are listed 'Best First'.
Re: Re (tilly) 3: Lisp is More Evaluatable
by hding (Chaplain) on May 24, 2001 at 20:15 UTC

    Probably we more or less agree, but have different ways of expressing what we mean. Graham is good, but I think it's dangerous to rely too much on what he says. Just as an example, he seems to have a disdain for the loop macro that just isn't shared by the community at large, and if unduly under his influence one might neglect to use it even in situations where it's clearly the easiest and best solution. But (like Perl) there's room enough in Lisp for everyone, at least IMHO. :-)

    One should be careful about relying on tail recursion being optimized in Common Lisp, too. The spec doesn't require it (unlike Scheme which does). I think most implementations will do it under certain but not all circumstances. For example, in the one I use, you need to have debug set below 3 in the code to be compiled. I don't have a good enough sense of history to speculate whether this is because of or the cause of Common Lispers being a lot more willing to iterate than Schemers.