Welcome to the CHICKEN Scheme pasting service

Find largest pasted by dsp on Mon May 23 14:34:27 2011

(define (largest-sieve lst)
  (cond ((= (null? (car lst)) #t)
          (car lst))
        ((> (car lst) (cadr lst))
          (largest-sieve (cons (car lst) (cddr lst))))
        ((< (car lst) (cadr lst))
          (largest-sieve (cons (cadr lst) (cddr lst))))))

cleaned up added by C-Keen on Mon May 23 14:52:13 2011

(define (largest-sieve lst)
    (cond ((null? lst) (error "list empty")) ; or 0? depends
             ((null? (car lst)) 0)
             (else (let ((m (max (car lst) (cadr lst))))
                           (largest-sieve (cons max lst) (cddr lst))))))

; untested though

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which R5RS procedure returns `'(2 3)' when given `'(1 2 3)' as input?
Visually impaired? Let me spell it for you (wav file) download WAV