On Jun 12, 5:58 pm, Meikel Brandmeyer <m...@kotka.de> wrote:
>
> (defn eager-seq
>    [s]
>    (into [] s))

I guess that'd work.

> > (with-files-line-seq (file1 file2 file3) lines
> >  (take 10 lines))
>
> The more idiomatic form would be [file1 file2 file3]
> for the file arguments. Using (file1 file2 file3) other
> than function calls is discouraged.

Yeah, actually I was paraphrasing. The first arg is a coll and I
probably did use a literal vector to pass it in.

> > (with-files-line-seq (file1 file2 file3) lines
> >  (eager-seq (take 10 lines)))
>
> (with-files-line-seq [file1 file2 file3] lines
>    (doall (take 10 lines)))

Meh. I'd thought all those do-foos returned nil, except plain do.

> > (defn to-file [str-or-file]
> >  (if (instance? File str-or-file) str-or-file (File. str-or-file)))
>
> I think this exists already somewhere in clojure.contrib.java-utils or  
> so.

Don't have that third-party library.

> > (defn reader-on [file]
> >  (BufferedReader.
> >    (InputStreamReader.
> >      (FileInputStream. file))))
>
> > (defn writer-on [file]
> >  (BufferedWriter.
> >    (OutputStreamWriter.
> >      (FileOutputStream. file))))
>
> Maybe clojure.contrib.duck-streams?

Don't have that third-party library.

> > (defn set-atom! [at value]
> >  (swap! at #(do % (identity value))))
>
> (reset! at value)
>
> You may complain about Clojure's documentation,
> but it's not thaaat bad.

Let's see.

http://clojure.org/atoms

firefox inc-search for "reset"

Oops, not found.

Sorry, the only way I'd have known about half of this was to actually
read the api docs cover to cover, and for half of the other half, to
download and install a third-party library and read ITS docs cover-to-
cover. :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to