|
|
|
|
|
by gruseom
5685 days ago
|
|
Why do you say LET and LET* have very different uses? I just use LET* if I need to reference a preceding variable in the same declaration (it happens). Actually I vaguely remember PG in one of his Lisp books saying LET* indicates bad code, something I never understood, though empirically I've noticed some evidence for it. |
|
One way to look at it is that we should use single-use functions as far as possible to keep code straightforward.
And as jpr said, LET* can potentially promote bad style, giving one the inclination to mix functional and imperative styles in a potentially troublesome fashion.
I think it was in 'On Lisp' that PG said that use of LET* should be minimised for the reasons above.
But if not, you're right. Use LET* just as you mentioned, but don't use LET* for all cases.
Some discussion available @ Stack Overflow: http://stackoverflow.com/questions/554949/let-versus-let-in-...