Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.35 KB | None | 0 0
  1. (defun merge (list1 list2)
  2.     (if list1
  3.         (if list2
  4.             (if (<=(car list1)(car list2))
  5.                 (cons
  6.                     (car list1)
  7.                     (cons
  8.                         (car list2)
  9.                         (merge (cdr list1)(cdr list2))
  10.                     )
  11.                 )
  12.                 (cons
  13.                     (car list2)
  14.                     (cons
  15.                         (car list1)
  16.                         (merge (cdr list1)(cdr list2))
  17.                     )
  18.                 )
  19.             )      
  20.         list1
  21.         )
  22.     list2
  23.     )
  24. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement