• (into to from)
Returns a new coll consisting of to-coll with all of the items of
from-coll conjoined.

4 Examples top

  • ; Adds a list to beginning of another.  Note that elements of list are added in reverse since each is processed sequentially.
    (into '(1 2 3) '(4 5 6))
    
    => (6 5 4 1 2 3)
  • ; Adds a list into an empty list.  Because of the sequential processing, this also essentially produces a reversed version of the original list.
    (into () '(1 2 3 4))
    
    => (4 3 2 1)
    
  • (into [5 6 7 8] '(1 2 3 4))
    ==> [5 6 7 8 1 2 3 4]        
    (into #{5 6 7 8} [1 2 3 4])
    ==> #{1 2 3 4 5 6 7 8}       
    (into [[5 6] [7 8]] #{[1 2] [3 4]})
    ==> [[5 6] [7 8] [3 4] [1 2]]  
    (into #{{5 6} {7 8}} [{1 2} {3 4}])
     ==> #{{5 6} {1 2} {3 4} {7 8}} 
  • (defn all-files-present?
    "Takes a list of real file names, and returns a sequence of maps 
     indicating  the file name and its availability status 1 for 
     present and 0 for not present."
      [file-seq]
      (for [fnam file-seq
            :let [stat-map {(keyword fnam) (if (= (look-for fnam "f") 0)
                                                  1
                                                  0)}]]
       stat-map))
    
    (into {}  (all-files-present? '("Makefile" "build.sh" "real-estate.csv")) )
    {:Makefile 1, :build.sh 1, :real-estate.csv 0}
    
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/generic/collection.clj:95 top

(defmulti into
  "Returns a new coll consisting of to-coll with all of the items of
  from-coll conjoined."
   {:arglists '([to from])}
  (fn [to from] (type to)))
Vars in clojure.contrib.generic.collection/into: defmulti fn into type
Used in 0 other vars

Comments top

No comments for into. Log in to add a comment.