Dearest members of the Lispforum.
I'm 22 years old and Belgian.
A few months ago, I had an examination about LISP.
We had to write a sorter function.
eg. ยด(1 8 4 6 9 7) --> (9 8 7 6 4 1)
This is what I have written:
(defun sorter A
(cond (null A) nil)
(eq (difference ((car a) (greatest A)) 0) (cons (car A) (sorter cdr A)))
(t ( sorter (cons (cdr A) (car A)))))))
defun greatest (A)
and so on..
The teacher said it was totally wrong. But I don't see my mistake? Is it totally wrong? He gave me an F for this
I will see him tomorrow and I would like to have some professional help. So please tell me, is it totally wrong or are there some good things about what I have written? Would you also give me an F?
Thanks a lot in advance,
kindly regards.
I'm 22 years old and Belgian.
A few months ago, I had an examination about LISP.
We had to write a sorter function.
eg. ยด(1 8 4 6 9 7) --> (9 8 7 6 4 1)
This is what I have written:
(defun sorter A
(cond (null A) nil)
(eq (difference ((car a) (greatest A)) 0) (cons (car A) (sorter cdr A)))
(t ( sorter (cons (cdr A) (car A)))))))
defun greatest (A)
and so on..
The teacher said it was totally wrong. But I don't see my mistake? Is it totally wrong? He gave me an F for this
I will see him tomorrow and I would like to have some professional help. So please tell me, is it totally wrong or are there some good things about what I have written? Would you also give me an F?
Thanks a lot in advance,
kindly regards.