[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: The FIXME in `dotimes'
From: |
Philip Kaludercic |
Subject: |
Re: [External] : Re: The FIXME in `dotimes' |
Date: |
Wed, 07 Sep 2022 15:26:51 +0000 |
Drew Adams <drew.adams@oracle.com> writes:
>> >> (dotimes (count) ...)
>> >
>> > Lisp syntax rarely make the first element optional, and in this case
>> > it's both the first and the last one:
>> >
>> > (dotimes ([VAR] COUNT [RESULT]) BODY...)
>> >
>> > which is a bit alien, and it's perhaps not worth the trouble for just
>> > omitting an underscore?
>> >
>> >> (dotimes count ...)
>> >
>> > That wouldn't allow for arbitrary expressions so it's of limited
>> > utility (and Lisp-alien, again). There's also the risk that someone
>> > will eventually replace a variable by a function call, turning
>> > (dotimes x ...) into (dotimes (f x) ...).
>>
>> I agree, the idea was not well thought out and not worth the
>> complication.
>
> In addition to what's been said - It's not bad,
> other things being equal, to keep it more or
> less in sync with what it's taken from, which
> is Common Lisp DOTIMES (and which apparently
> was inspired by Interlisp's RPTQ).
Interesting, I was not familiar with this history:
(RPT n form) [Function]
Evaluates the expression form, n times. Returns the value of the last
evaluation. If n < 6, form is not evaluated, and RPT returns NIL.
Before each evaluation, the local variable RPTN is bound to the number
of evaluations yet to take place. This variable can be referenced within
form. For example, (RPT 10 '(PRINT RPTN)) will print the numbers 10, 9,
• • • 1, and * return 1,
(RPTQ n FORMi form 2 ... form n ) [NLambda NoSp read Function]
Nlambda-nospread version of RPT: n is evaluated, form, are noL Returns
the value of the last evaluation of form n .
From:
https://archive.org/details/bitsavers_xeroxinternceManualOct1983_52302609/page/n119/mode/2up