James Reeves wrote:
> On Apr 6, 4:10 am, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
>> I don't see an obvious way of combining them.
> 
> What about something like:
> 
> (defn- normalize-separator
>   [filepath]
>   (.. (str filepath)
>     (replace \\ File/separatorChar)
>     (replace \/ File/separatorChar)))
> 
> (defn file
>   [filepath & more]
>   (reduce
>     (fn [parent path] (File. parent path))
>     (File. (normalize-separator filepath))
>     (map normalize-separator more)))

I think there may be a misunderstanding over "combining" here - I read 
Stuart's mail to mean there was no obvious way to combine 
duck-streams/file and java-utils/file, whereas this implementation shows 
java-utils/file style behaviour only?

IMO even if the two functions could be combined, it would be confusing 
to understand how the arguments passed in would be joined.  Better not 
to try.

FWIW, the java-utils version is similar to a utility method that I use 
pretty heavily in Java code -- so I will find it useful.

Cheers,
Jason

-- 
Pulse - Continuous Integration made easy.
Does your project have a pulse?
Try it free at: http://zutubi.com

--~--~---------~--~----~------------~-------~--~----~
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
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