That makes perfect sense. 


----- David Cuddeback's Original Message -----
> > @@ -24,6 +24,19 @@
> >      (Pail/create filesystem path spec fail-on-exists)
> >      (Pail/create path spec fail-on-exists)))
> >  
> > +(defn find-or-create [pstruct path & {:as create-key-args}]
> > +  "Get a pail from a path, or create one if not found"
> > +  (try (pail path)
> > +       (catch Exception e
> > +         (apply create (spec pstruct) path
> > +                (mapcat identity create-key-args)))))
> > +
> > +(defn write-objects
> > +  "Write a list of objects to a pail"
> > +  [pail objects]
> > +  (with-open [writer (.openWrite pail)]
> > +    (doall (map #(.writeObject writer %) objects))))
> 
> Usually `map` implies that you care about the result. In fact, `doall` will retain the head of the seq, so if this is used to write a lazy seq containing gigabytes of objects, this will consume gigabytes of memory, returning a list of `nil` objects. I think what we want here is `doseq`, because we only care about the side-effects and `doseq` doesn't retain the head:
> 
> ```clojure
> (doseq [o objects]
>   (.writeObject writer o))
> ```
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/dcuddeback/clj-pail/pull/1/files#r8665330

-- 

Eric Gebhart
e.a.gebhart@gmail.com