From: Geoffrey K. <ge...@kn...> - 2003-03-07 16:53:57
|
I ran into something similar this morning. Both (car ()) and (cdr ()) returned (), while according to MIT Scheme, which I use for reference, feeding () to either car or cdr was a no-no. In the case of car, I knew that. In the case of cdr, I had to remember that (cdr ()) was OK in Lisp but not in Scheme. Like Rusty, I don't mind that (cdr ()) returns (), but I have a small problem. I have some expressions to debug that look like (caar (cddr X)) that I'm trying to debug by taking them apart (car (car (cdr (cdr X)))), and I'm getting exceptions in the former but not in the latter. Geoffrey On Friday, March 7, 2003, at 11:20 AM, Robert J. Bobrow wrote: > Folks, > I would expect that (cadr x) and (car (cdr x)) would behave > identically in all circumstances. Yet I find that car and cdr behave > like Common Lisp and return '() when given '() as an argument (I like > this, personnaly) and cadr throws an exception when handed '(); > > I think the inconsistency is annoying -- I really prefer not to have > (car (cdr x)) in my code. > > Any recommendations? > --Rusty Bobrow |