2012-01-26 19 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?())と(空? ))。あなたは(rest lst)を使い、(rest())is()は無しではありません。 – unionx

関連する問題