-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, 12 Jun 1998 14:08:37 GMT, I wrote:
> (defun primes (n)
> (when (> n 1)
> (let* ((primes (list 2))
> (last primes)
> (max (floor (sqrt n))))
> (do ((i 3 (+ i 2)))
> ((> i n) primes)
> (do* ((next primes (rest next)))
> ((or (null next)
> (> (first next) max))
> (rplacd last (list i))
> (setq last (rest last)))
> (when (zerop (rem i (first next)))
> (return)))))))
instead of
(defun primes-do (n)
(when (> n 1)
(let* ((primes (list 2))
(last primes)
(max (floor (sqrt n))))
(do ((i 3 (+ i 2)))
((> i n) primes)
(do* ((next primes (rest next))
(p (first primes) (first next)))
((or (null p) (> p max))
(rplacd last (list i))
(setq last (rest last)))
(when (zerop (rem i p))
(return)))))))
(otherwise the internal do* wouldn't be needed; do would suffice).
Juanma
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.5.3i; see <http://www.pgpi.com>
iQA/AwUBNYExvP4C0a0jUw5YEQLgdgCdGOWLM+59WRiQo5V3zRJRbjDwoU8AnRbm
zV4cfXacYZk8pKLIDwchnc/I
=/3V2
-----END PGP SIGNATURE-----