Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

FORCE INDENTATION OF LISP

Name: Anonymous 2007-07-20 11:02 ID:a6DFnjq5

define
  is-prime x
  "Tests if x is prime using the Sieve of Eratosthenes"


    define
      divides? n primes
      "Does n divide with any of the primes?"

      if (not (eq? primes '())
        if (not (= (modulo n (car primes)) 0))
          divides? n (cdr primes)     
          #t                              
        #f                            


    define
      iter x n primes
      "Does n divide with any of the primes?"

      if (<= n x)
        if (divides? n primes) 
          if (= n x)                         
            #f                           
            iter x (+ n 2) primes                
          iter x
            + n 2                          
            append primes (list n)        
        #t                                

        if (not (= 0 (modulo x 2)))        
           iter x 3 '()                   
           #f

Name: Anonymous 2007-07-20 11:07 ID:Heaven

This is crap. Stop trying to make lisp look more acceptable to the masses by using alternative notation. If people are put off by syntax, they aren't smart enough to ever produce anything interesting.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List