Clojure REPL gets stuck printing doseq output in OS X but not on Linux
I'm running Clojure 1.2 on both my Snow Leopard OS X machine and my Ubuntu linux box via the lein repl
command. I am going through the enlive tutorial https://github.com/swannodette/enlive-tutorial/
When I get to the "Third Scrape" tutorial and run 开发者_如何学JAVAthis command:
(print-stories)
it works as expected on Ubuntu, but on OS X, it outputs only the first story and then outputs the rest only after I enter some expression, whether it is a number, a (println "hello world"), or whatnot. Something seems to be weird about the way the REPL is working on OS X -- as if the buffer is not flushing its output completely.
I notice that a doseq
macro is used in the print-stories
function. So if I do this:
tutorial.scrape3=> (doseq [x (map extract (stories))] (println x))
I get this output on OSX:
{:summary , :byline , :headline With Stones and Firebombs, Mubarak Allies Attack}
which is only the first item. If I then enter 0
(or any valid expression) and press return, I get the rest of the output:
0
{:summary The Conversation: Long, worthy road to democracy. , :byline , :headline }
{:summary The Frugal Traveler scores a cheap ticket to Malaga, Spain, birthplace of Picasso., :byline , :headline A Taste of Picasso (and Iberian Cuisine)}
{:summary Lay claim to the next great place: four emerging destinations., :byline , :headline Beat the Crowds}
[etc]
I also notice that this behavior is not consistent. Sometimes, nothing is output, and then I can flush it out by typing 0
or something and enter. Sometimes, it flushes out all the output properly.
Does anyone have any ideas?
As it happens I did the same enlive tutorial on snow leopard last night and the scrape3 (print-stories) function works fine for me. The doseq code in your question also works for me without stopping.
What output to you get if you run "lein version" at the command line? My version details are:
Leiningen 1.4.2 on Java 1.6.0_22 Java HotSpot(TM) 64-Bit Server VM
Cheers, Colin
It's not an OSX issue, that happened to me on ubuntu 10.10 as well. Might be related to rlwrap, which is used by leiningen AFAIK. I use cake nowadays.
精彩评论