redplanetlabs / specter

Clojure(Script)'s missing piece
Apache License 2.0
2.51k stars 102 forks source link

Transform all after FIRST #288

Closed stuartrexking closed 4 years ago

stuartrexking commented 4 years ago

I'm working with a CSV file and I want to transform values and ignore the header.

I can use (let [header & rows] csv) but I'd like to be able to do this using specter without splitting out the headers separately.

Is there an idiomatic way of doing this?

nathanmarz commented 4 years ago

You can do something like this:

(def REST (srange-dynamic (fn [_] 1) count))
(transform [REST ALL] inc [1 2 3 4 5])
;; => [1 3 4 5 6]