fork download
  1. (define (f ns)
  2. (define (aux m1 m2 ns)
  3. (if (null? ns)
  4. m2
  5. (let ((n (car ns)) (ns (cdr ns)))
  6. (cond
  7. ((not m1) (aux n #f ns))
  8. ((or (and (not m2) (< m1 n)) (< m1 n m2)) (aux m1 n ns))
  9. ((or (and (not m2) (< n m1)) (< n m1 m2)) (aux n m1 ns))
  10. (else (aux m1 m2 ns))))))
  11. (aux #f #f ns))
  12. (print (f '(4 5 1 7 1 2 8 9 2 7)))
  13. (print (f '(1 1 1)))
  14. (print (f '(1)))
  15. (print (f '()))
  16.  
Success #stdin #stdout 0.01s 7872KB
stdin
Standard input is empty
stdout
2
#f
#f
#f