Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun small- (lst)
- (labels ((helper-small (lst smallest)
- (cond
- ((and (null (cdr lst))(< smallest (car lst))) smallest)
- ((and (null (cdr lst))(> smallest (car lst))) (car lst))
- ((< smallest (car lst))(helper-small (cdr lst) smallest))
- (t
- (helper-small (cdr lst)(car lst))))))
- (helper-small (cdr lst)(car lst))))
- (defun remove- (lst remove-me)
- (cond
- ((null lst)'())
- ((equal (car lst) remove-me)(cdr lst))
- (t
- (cons (car lst)(remove- (cdr lst) remove-me)))))
- (defun order- (lst)
- (cond
- ((null (cdr lst))(cons (car lst)()))
- (t (let ((small (small- lst)))
- (let ((remain (remove- lst small)))
- (cons small (order- remain)))))))
- (defun order- (lst)
- (labels ((helper-order (lst final-lst)
- (cond
- ((null (cdr lst))(cons (car lst) final-lst))
- (t (let ((small (small- lst)))
- (let ((remain (remove- lst small)))
- (helper-order remain (cons small final-lst))))))))
- (helper-order lst ())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement