picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

sieve.l (312B)


      1 # 25feb10abu
      2 # (c) Software Lab. Alexander Burger
      3 
      4 # Sieve of Eratosthenes
      5 (de sieve (N)
      6    (let Sieve (range 1 N)
      7       (set Sieve)
      8       (for I (cdr Sieve)
      9          (when I
     10             (for (S (nth Sieve (* I I)) S (nth (cdr S) I))
     11                (set S) ) ) )
     12       (filter bool Sieve) ) )
     13 
     14 # vi:et:ts=3:sw=3