http://stackoverflow.com/a/8597734/849891 (Lisp)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- http://stackoverflow.com/a/8597734/849891 

(defun longest (xs)
  (prog  ((a nil) (i 0) b j x)
      G2  (if (null xs) (return (reverse a)))
          (setf x (car xs) xs (cdr xs))
          (if (evenp x)
            (go G2))
      G3  (setf b (list x) j 1)
      G4  (if (null xs)
            (if (> j i)
              (return (reverse b))
              (return (reverse a))))
          (setf x (car xs) xs (cdr xs))
          (if (evenp x)
            (progn
              (if (> j i) (setf a b i j))
              (go G2)))
          (if (>= x (car b))
            (progn
              (if (> j i) (setf a b i j))
              (go G3)))
          (setf b (cons x b) j (+ j 1))
          (go G4)))