2

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

dan
  • 43,914
  • 47
  • 153
  • 254

2 Answers2

1

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

colinf
  • 1,866
  • 1
  • 12
  • 8
1

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.

0x89
  • 2,940
  • 2
  • 31
  • 30
  • Is cake a replacement for lein? – dan Feb 03 '11 at 00:36
  • Kind of. It is compatible with most leiningen project.clj files, and has some advantages over leiningen (e.g. persistent JVM). See: https://github.com/ninjudd/cake. There seems to be more activity on leiningen, though.. – 0x89 Feb 03 '11 at 15:16
  • also see http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen – 0x89 Feb 03 '11 at 22:16