[Cs254f11] pmap problem

Lee Spector lspector at hampshire.edu
Mon Nov 21 14:58:49 EST 2011


[ I'm echoing to the list, since some others were watching this and may be interested. ]

Very interesting. Looks like it is indeed an eval/pmap interaction bug, but that it has been fixed; I'm pretty sure from what you say that it must be fixed in Clojure 1.3, and that clooj 0.2.6 is working just because it uses Clojure 1.3.

On getting the string stuff to work in 1.3: the whole idea of contrib has changed radically in Clojure 1.3, which is one of the reasons that I didn't want to deal with the transition mid semester. But all of the important functionality still exists, just not in a big "monolithic" contrib JAR, but rather in smaller libraries. I haven't dealt with this myself but I'm pretty sure that clojure.contrib.string stuff will be easily accessible, but in a slightly different way (and you'll need to use leiningen to pull in the library. For details I'd start here:

http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

 -Lee


On Nov 21, 2011, at 2:45 PM, Wm. Josiah Erikson wrote:

> So here is an extremely simple example of the problem:
> 
> (defn pd
>  "Protected division; returns 0 if the denominator is zero."
>  [num denom]
>  (if (zero? denom)
>    0
>    (/ num denom)))
> ;#'critic_evolution.core/pd
> 
> (def sample-vector ['(pd 5 6) '(+ 5 6)])
> ;#'critic_evolution.core/sample-vector
> sample-vector
> ;[(pd 5 6) (+ 5 6)]
> (map eval sample-vector)
> ;(5/6 11)
> (pmap eval sample-vector)
> ;#<Exception java.lang.Exception: Unable to resolve symbol: pd in this context>
> 
> Also, I have "solved" the problem. Maybe Arthur won't care that this is a problem, because the problem does not exist in Clooj 0.2.6 - does that make it a clojure problem and not a clooj problem?
> 
> I tried just moving my code to clooj 0.2.6, but my clojure.contrib.string broke:
> critic_evolution.core=>#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath: >
> 
> I can probably figure that out, though... maybe it's called something else now.
> 
> -- 
> Wm. Josiah Erikson
> Network Engineer
> Hampshire College
> Amherst, MA 01002
> (413) 559-6091
> 

--
Lee Spector, Professor of Computer Science
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438



More information about the Cs254f11 mailing list