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-21 10:50 ID:eYh2hgHI

>>22 , >>27

* it makes (READ) about a million times more complicated as you have to count spaces, and it requires lookahead. That means global memory for a stream. Ick.

* it requires more typing. entering [let[[x y]]TAB CR[sage x]]TAB versus "spacespacespacespaceLETspacespaceXspaceYenterspacespacespacespacespacespaceSAGE X"

* Whitespace is susceptible to errors in transmission (or changes in meaning). It makes programs hard to enter into TeX, HTML, markdown, and everywhere but in jEdit.

* Quasiquote/comma is important.

* VI users cannot use % to bounce between edges of the sexp and emacs wouldn't have anything to hilight.

* Only inexperienced programmers have a problem with parens anyway. They need to stop being so offended by the fact that after "ten years of java and C", they're still beginner programmers to some simply because they can't read the code of people well above their skillset, nor code written by people well below their skillset.

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