I tried to write a little storting program, but I make a mistake in calling the function "sort-insert". Can anybody tell me my mistake?
Code: Select all
(setq test-list (list 3 5 1 2 9 4 7 8 6))
(defun sort-list(ulist)
(let ((nlist (list)))
(dolist (x ulist)
(setq nlist `(sort-insert ,x ,nlist))
)
(setq ulist nlist)
)
ulist
)
(defun sort-insert(element liste)
(let ((blist (list)) (filled 0))
(dolist (x liste)
(when (and (> x element) (= filled 0))
(setq blist `(,@blist ,element))
(setq filled 1)
)
(setq blist `(,@blist ,x))
)
(print blist)
(setq liste blist)
)
liste
)