On Aug 25, 2011, at 2:00 PM, Terje Dahl wrote:

> Great question.  And great answer.
> Seriously!  I did not know it could be that easy.
Unfortunately it's not actually that easy, at least for the OP's question of 
reading from and writing to (presumably local) files.

While slurp and spit are beautifully elegant it's not so elegant to tell slurp 
how to find the file you want it to slurp. In many other languages/environments 
there's a concept of the working directory or project directory, relative to 
which you can specify locations. In Clojure you have to deal with the 
classpath, outside of the language proper, and many of the common ways of 
running Clojure programs handle this differently. I don't know if there's a 
good, general solution to this, but for me (both as a programmer and especially 
as a teacher) it is definitely a pain point.

In my current configuration (in Mac OS X running clooj -- which is really 
shaping up beautifully, BTW) spit with a simple file name seems to go to my 
Downloads directory. I don't know why or how to change it. 

Much worse is the problem with interactive console-based I/O, which is often 
one of the things that a beginner will often want to play with to get the feel 
of a language; many of my students try to write a simple text adventure game 
for their first projects, and with Clojure I basically have to tell them to 
forget about it. (If you don't know what I'm talking about see the exchanges 
here: 
http://groups.google.com/group/clojure/browse_thread/thread/9261480fbea72ead/4ec300e9cc76a184?lnk=raot).
 There are ways to make console-based I/O work , but it fails in ugly ways in 
many setups.

 -Lee

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