Advertisement
triclops200

range in scheme lisp

Jun 28th, 2012
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.21 KB | None | 0 0
  1. (define range (lambda (n m) (cond
  2.     ((> n m)
  3.         '()
  4.     )
  5.     (#t
  6.         (cond
  7.             ((= m n)
  8.                 (cons n '())
  9.             )
  10.             (#t
  11.                 (append (range n (halfway n m)) (range (+ (halfway n m) 1) m ))
  12.             )
  13.         )
  14.     )
  15.     )
  16. ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement