I would have never made that mistake, and you could have easily tested it in a REPL. (cons 'let (cons 'paramlist 'body))
;=> (LET . (PARAMLIST . BODY)) => (LET PARAMLIST . BODY)
(list 'let 'paramlist 'body) => (LET PARAMLIST BODY)
; the first one is not a proper list for it does not end with a NIL, the first can also be written as:
(list* 'let paramlist body) instead of (cons 'let (cons paramlist body))
Learn the difference between LIST and LIST*, it may save your life one day!!!
And, if I were doing this for a macro, I would have just used backquote `(let ,paramlist . ,body) or `(let ,paramlist ,@body)
Name:
Anonymous2009-11-21 17:20
>>2
I hadn't noticed it, since it was buried deep down in my evaluator, and all the test data only had one list in body. I realise this isn't an excuse, since I should have had better test coverage.
A good one that got me often was forgetting to implement a copy constructor, and chasing down a copy bug for hours. I hate sepples. Of course these days GCC has a warning against that (the C++ style bullshit), but it comes with so much other baggage...