« back

Using Clojure-Contrib

05 Nov 2012

Maybe my contribution can be to pass this info along...

While learning to work with clojure and working through some Project Euler problems, I was looking through the ClojureDocs and found exactly what I needed. primes. Okay, so I put it in my code and it was not working. I was getting errors about my classpath and I wasn't sure what was going on. Then I decided to google "Using primes in clojure" and I came across several uses of this that seemed to all have a similar line at the top of their code that looked like one of these...

1  
2         (use 'clojure.contrib.lazy-seqs)
3         
4         or
5         
6         (require  'clojure.contrib.lazy-seqs)
7     

Then I googled "clojure require" and ended up finding a great article written by Colin about Libs and namespaces. Okay, sounds good. That was all new and very informative. I'm ready to rock, So why can I not get primes to work?

I was also working on trying to use one of the math methods and I was having the same problem and I finally asked another apprentice for help. He was able to direct me to the fact that the contrib library had recently been split up and that I may need to require something different. Whew! See here for an explanation and redirect information.

After getting one of the namespace to work with the new redirect for Math, I still could not get primes to work!!!! I checked out the Where did Clojure Contrib page go but did not see a redirect. What did this mean? I needed help again. Then, it was brought to my attention by a craftsman that lazy-seq was probably no longer being maintained. What? Why was it in the doc? Could I just use 1.2(which seemed to be what other people were using it with)?

Feeling still confused, I revisited the where did clojure contrib go, but this time, I decided to read those several paragraphs at the top instead of thinking "yeah, get to the part I need." Guess what, you learn a lot when you "Read the Freaking Manual". It says clearly "If a clojure.contrib namespace is listed here but has no migration details, that means no one has volunteered to maintain that namespace." If no one maintains it, it no longer exists for the current version. Poof, it is gone. Now, you could go back and use the version 1.2 but it will likely break other dependencies. It did for me. I really do need to write my own primes function anyways. It was kind of fun once I went down the clojure contrib lazy-seqs rabbit hole and I wanted to see how deep I would have to go until I could find out about primes!

comments powered by Disqus