2012-01-26 3 views

답변

2
(defn my-insertion-sort [lst] 
    (loop [list lst result '()] 
    (if (empty? list) result 
     (recur (rest list) (my-insert (first list) result))))) 

(defn my-insert [n lst] 
    (cond 
    (empty? lst) (list n) 
    (> (first lst) n) (conj lst n) 
    :else (conj (my-insert n (rest lst)) (first lst)))) 
+0

괜찮습니다. 이 차이를 만드는 이유는 무엇입니까 (비어 있지?)? (비어 있지?). – lkahtz

+0

이것을 다른 질문으로 요약합니다. http://stackoverflow.com/questions/9025124/what-is-the-difference-between-seq-and-seq – lkahtz

+1

(nil?()) 및 (empty?)). 당신은 (rest lst)를 사용했고 (rest()) is는(), nil이 아닙니다. – unionx