Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun small- (lst)
- (defun helper (lst m)
- (cond
- ((and (null (cdr lst))(< m (car lst))) m)
- ((and (null (cdr lst))(> m (car lst)))(car lst))
- ((< m (car lst))(helper (cdr lst) m))
- ((> m (car lst))(helper (cdr lst)(car lst)))))
- (helper (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)
- (defun helper (lst final-lst)
- (cond
- ((null (cdr lst))(cons (car lst) final-lst))
- (t
- (let ((small (small- lst)))
- (let ((remain (remove- lst small)))
- (helper remain (cons small final-lst)))))))
- (helper lst ()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement