Looking for the inverse of slurp

15 views
Skip to first unread message

Ethan Herdrick

unread,
Nov 16, 2008, 12:58:56 AM11/16/08
to clojure
Has the inverse of slurp been added to the core libraries yet? Like this:

(spit "Some text" "/foo.txt")

to make a file called 'foo.txt' containing "Some text".

By the way, it appears that Clojure (or Java) doesn't recognize ~, as
in (slurp "~/foo.txt"). True?

Stuart Halloway

unread,
Nov 16, 2008, 9:18:48 AM11/16/08
to clo...@googlegroups.com
Hi Ethan

spit is in Clojure-contrib. I wouldn't expect Clojure to support OS-
specific idioms like ~, because Java doesn't.

Stuart

> -~----------~----~----~----~------~----~------~--~---
>

Stuart Sierra

unread,
Nov 16, 2008, 1:06:11 PM11/16/08
to Clojure
Yes, spit is in clojure.contrib.duck-streams.

Java doesn't support "~", but if you want the home directory you can
get it with
(System/getProperty "user.home")
-Stuart

Ethan Herdrick

unread,
Nov 16, 2008, 4:03:06 PM11/16/08
to Clojure
Thanks, Stuarts!

On Nov 16, 10:06 am, Stuart Sierra <the.stuart.sie...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages