I would like to rewrite in scheme a script I made in clojure but I'm not sure how.
I wrote this simple script in clojure. It reads some csv files, processes them a bit and writes a new csv files.
It's based on a bunch of functions each accepting a map as an argument and returning a new map
The main loop uses the transducers. A transducer made of composing such functions in the right order. Like this
(def step1 (mapcat (comp
op/line-numbers
op/station
op/added-file-order
op/splitted-file
op/ingested-file)
))
The transducer is then made into a a lazy sequence. Like this
(defn thread [path]
(sequence
(comp step1 step2 step3 step4)
(op/files-collection path)))
The sequence is then lazily written to a file.
I'm mumbling about implementing the same functionality (and in the future maybe more) in guile scheme
I know scheme has streams (as lazy sequences) but I'm not sure the semantics is the same as in clojure.
How would such a thing be made in scheme ? What's the idiomatic scheme version of such a thing ?