interpose

clojure.core

  • (interpose sep coll)
Returns a lazy seq of the elements of coll separated by sep

1 Example top

  • ;; The quintessential interpose example:
    
    user> (def my-strings ["one" "two" "three"])
    
    user> (interpose ", " my-strings)
    => ("one" ", " "two" ", " "three")
    
    user> (apply str (interpose ", " my-strings))
    => "one, two, three"
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:4540 top

(defn interpose
  "Returns a lazy seq of the elements of coll separated by sep"
  {:added "1.0"
   :static true}
  [sep coll] (drop 1 (interleave (repeat sep) coll)))
Vars in clojure.core/interpose:
Used in 0 other vars

Comments top

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