Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.lisp
Re: better way to enumerate
William James
1/7/2016 9:48:00 AM
Kaz Kylheku wrote:
> (defun enumerate-with-op-iter (start end &aux elist)
> (loop
> ;; test terminating condition, return result
> (when (> start end)
> (return (reverse elist)))
> ;; update variables for next iteration
> (psetf
> start (1+ start)
> elist (cons start elist)))))
MatzLisp (Ruby):
The hard way:
def number_sequence low, high
result = []
while low <= high
result << low
low += 1
end
result
end
The easy way:
(low .. high).to_a
Another way:
low.upto(high).to_a
--
[A]n unholy alliance of leftists, capitalists, and Zionist supremacists has
schemed to promote immigration and miscegenation with the deliberate aim of
breeding us out of existence in our own homelands.... [T]he real aim stays the
same: the biggest genocide in human history.... --- Nick Griffin
(
https://www.youtube.com/watch?v=K...
)
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: better way to enumerate
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password