Message-ID: <192354Z10101995@anon.penet.fi>
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.kei.com!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!EU.net!news.eunet.fi!anon.penet.fi
Newsgroups: comp.lang.scheme
From: an228270@anon.penet.fi
X-Anonymously-To: comp.lang.scheme
Organization: Anonymous forwarding service
Reply-To: an228270@anon.penet.fi
Date: Tue, 10 Oct 1995 19:18:34 UTC
Subject: Help me please.
Lines: 30



Can anybody help me i am having trouble with do loops, to be precise
i haven't a clue on how they work. Take the program below which is
meant to sort numbers out in a list ie (4 6 3 1) to (1 3 4 6). Am i
on the right tracks?

Steve.


(define a2
 (let ((x ())
       (result ()))
   (lambda (ls x result)
(do ((i 1 (+ i 1)))
     (null? ls) result 
    (a2 ls x result)))
    (set! x (max-list ls))  
      (set! ls (remove-left-most x ls))
      (set! result (cons x result))))
   
(define (remove-left-most e ls)
  (cond ((null? ls) ls)
	((eqv? e (car ls)) (cdr ls))
	(else (cons (car ls) (remove-left-most e (cdr ls))))))
--****ATTENTION****--****ATTENTION****--****ATTENTION****--***ATTENTION***
Your e-mail reply to this message WILL be *automatically* ANONYMIZED.
Please, report inappropriate use to                abuse@anon.penet.fi
For information (incl. non-anon reply) write to    help@anon.penet.fi
If you have any problems, address them to          admin@anon.penet.fi
