Hey Stephen,
On Fri, Sep 21 2018, Stephen Feyrer wrote:
user=> (def some-numbers ‘(2 4 6 8)) #This is my value to test
later.
#’user/some-numbers
At this point we have some-numbers = '(2 4 6 8)
user=> (def evens? (partial (when (apply = (map even?
some-numbers)))))
#’user/evens?
Let's work through this:
(map even? '(2 4 6 8)) = '(true true true true)
(apply = '(true true true true)) = true
(when true) = nil
(partial nil) = nil
This means that we have evens? = nil
user=> (evens? (println “one”))
one
NullPointerException user/eval239 (NO_SOURCE_FILE:74)
So now we have:
(println "one") = nil (with the side effect of printing "one")
(nil nil) throws NullPointerException
Clojure is attempting to call nil as a function, which throws a
NullPointerException.
I hope that helps! I'm not sure what you're actually trying to do,
so it's hard for me to give advice on how to do it.
Carlo
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.