Clojure: cons (seq) vs. conj (list)

后端 未结 5 676
忘掉有多难
忘掉有多难 2020-12-04 05:17

I know that cons returns a seq and conj returns a collection. I also know that conj \"adds\" the item to the optimal end of the colle

5条回答
  •  臣服心动
    2020-12-04 06:12

    Another difference is the behavior of list?

    (list? (conj () 1)) ;=> true
    (list? (cons 1 ())) ; => false
    

提交回复
热议问题