Thanks Travis this was exactly what I was looking for:
(import '(java.io File)) (first (filter #(re-matches #".*\.txt" %) (.list (File. "./") ))) I am using the csv parser from : http://github.com/davidsantiago/clojure-csv I would enjoy seeing your implementation On Dec 13, 2:19 am, Travis <twell...@gmail.com> wrote: > On Dec 12, 11:20 am, Scott <sbuck...@gmail.com> wrote: > > > Trying to learn clojure via some simple examples. > > > I would like to use a simple glob expression to open a file using read- > > line > > > How would I write the equivalent of: > > > (for [line (read-lines "*.txt")] > > (print line)) > > > Where *.txt would match only the first file found in the present > > working directory > > I haven't tried executing these, but maybe something like this: > > (slurp (first (filter #(re-matches #".*\.txt" %) (.list (File. > "directory/path"))))) > > Or, more verbose but using Java's standard FilenameFilter > > (slurp (first (.list (File. "directory/path") > (proxy [FilenameFilter] [] > (accept [fil nam] (if (re-matches #".*\.txt" nam) true false)))))) > > > what I am actually trying to write is a program to read in a CSV, > > apply to a hash-map, and extract some simple data, so the above is > > intentional simplification > > > very powerful language, thanks to all that have worked on this > > I have a function for parsing CSVs that I put to work a lot at my last > job, using the Ostermiller utils. It works for very large CSVs and is > fairly thoroughly tried. > Send me an email directly if you're stuck on that. -- 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