*********************************Edit******************************
Change name from NumberSort to BadNumberSort and did not change recursive cases
*********************************Edit******************************
Okay I know this is not a efficient method but I am new to Lisp and get a pass on posting bad code.
How would I make this keep calling itself until list is sorted?
I have tried
while list not equal to result of calling function
if statements
etc...
(defun BadNumberSort (lst)
(cond
((null lst) lst)
((null (cadr lst)) lst)
((< (car lst) (cadr lst)) (cons (car lst) (BadNumberSort (cdr lst))))
(T (cons (cadr lst) (BadNumberSort (cons (car lst) (cdr (cdr lst))))))
)
)
So how can I make it call itself for example 3 times for the given list below.
Just a list of integers, I have not made it to the chapter with dotted pairs, reals, decimals so I am not worried about that right now.
_$ (BADNUMBERSORT '(5 3 4 1 2))
(3 4 1 2 5)
_$ (BADNUMBERSORT '(3 4 1 2 5))
(3 1 2 4 5)
_$ (BADNUMBERSORT '(3 1 2 4 5))
(1 2 3 4 5)