[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arg count checking
Date: Mon, 1 Apr 85 21:43 EST
From: Kent M Pitman <KMP@SCRC-STONY-BROOK.ARPA>
This is interesting. I hadn't ever thought about
(MAPCAR #'(LAMBDA (X &OPTIONAL (Y 0)) (LIST X Y)) '(A B C D) '(1 2))
I suppose one could argue that returning ((A 1) (B 2) (C 0) (D 0)) would
have been the "right" thing.
You'd have to change the definition of MAPCAR. Currently it's defined
to stop after any of the lists run out. You'd have to change it;
perhaps to say that it should keep going until ALL of the lists run out,
but the old rule was there for a reason. Or that it should stop as soon
as any of the lists that are being used as "required" argument run out,
although that's on the hirsute side.
(MAPCAR #'(LAMBDA (&OPTIONAL (X 0) (Y 0)) (LIST X Y)) '(A B C D) '(1 2))
might have been a little harder to deal with ... since presumably that
just wouldn't return...
No. Under any of the possibilities above, it must terminate after four steps.
of course, the fact that
(MAPCAR #'(LAMBDA (&OPTIONAL (X 0)) (PRINT X)))
loops indefinitely rather than returning argues in favor of such a position.
... I think.
The first list argument to MAPCAR is required, so this simply bombs out with
too few arguments to MAPCAR.
I definitely agree these two issues are not different. I think this just
shows that what multiple value return does is wrong. I've held the position
for quite some time that multiple values should have to be &OPTIONAL'd
and &REST'd. I believe there are others on this committee who side with me,
but we were in the minority in the discussions leading up to the current spec.
Perhaps that will change with time.
That's right. This was argued to death, and the present behavior was
arrived at after lots of discussion about both (and other) schemes.