Yup, juxt is definitely useful, but you need to understand what it is really 
doing.

In your case you have three “functions” and you’re invoking them each with two 
arguments. Let’s look at those:

(:who {:who 1 :when 2} missing) ;; where missing is {:who 4 :what 99} => 1
(:what {:who 1 :when 2} missing) ;; where missing is {:who 4 :what 99} => 
missing, i.e., {:who 4 :what 99}
(:when {:who 1 :when 2} missing) ;; where missing is {:who 4 :what 99} => 2

Does that help?

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

From: lawrence.krub...@gmail.com<mailto:lawrence.krub...@gmail.com>
Sent: Saturday, July 15, 2017 8:52 PM
To: Clojure<mailto:clojure@googlegroups.com>
Subject: What is juxt really doing?

If I do this:

((juxt :who :what :when) {:who 1 :when 2} {:who 4 :what 99})

I get:

[1 {:who 4, :what 99} 2]

Why does a map come back instead of a number?

Does anyone use juxt in the real world, or is mostly for examples?


--
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<mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

-- 
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.

Reply via email to