[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question regarding FORMAT with ~:^ within ~:{



I have a question regarding the correct behavior of FORMAT.  Please
open up your CLtL books to page 406 and tell me what the following
construct should return:

	(format nil "~:{~@?~:^...~}" '(("a") ("b")))


MY CLAIM: It should return "a".

THE RATIONALE: According to the Steele's spec, the ~:^ construct (with
the : modifier) should exit ALL iterations, therefore, FORMAT only gets
as far as printing the "a" before it quits.  CLtL page 406 states that:

   "If ~^ is used within a ~:{ construct, then it merely terminates
   the current iteration step (because in the standard case it tests
   for remaining arguments of the current step only); the next
   iteration step commences immediately.  To terminate the entire
   iteration process, use ~:^."


OTHER PEOPLE CLAIM: It should return "a...b".

THE RATIONALE: Since ~:^ is planning to exit the entire iteration it
should check whether there are more arguments to the entire iteration,
rather than checking for more arguments in the current sublist.


A SYMBOLICS 3600 CLAIMS: It should return "a...b"

THE RATIONALE:  I don't know, but that's what I got when I typed the
example in.


In closing, I might even agree that "a...b" would be more useful
behavior, but it is not in keeping with a strict interpretation of
Steele's specification.  I'd be interested in cogent comments and
clarifications.

- Robert Poor
  Lucid, Inc