fork(2) download
  1. ; brush strokes
  2.  
  3. (define (f x)
  4. (do ((x x (cdr x)) (p 0 (car x))
  5. (s 0 (+ s (max (- (car x) p) 0))))
  6. ((null? x) s)))
  7.  
  8. (display (f '(1 4 3 2 3 1))) (newline)
  9.  
  10. (display (f '(4 1 2 1 2 2))) (newline)
Success #stdin #stdout 0.01s 50288KB
stdin
Standard input is empty
stdout
5
6