You're viewing version 1.2.0 of interpose. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

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:4084 top

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

Comments top

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