> user=> ('b '{a 10, b 11, c 12})
> 11

Ah, yes so the 1 arg version is the map lookup, which also works in
reverse
user=> ('{a 10, b 11, c 12} 'b)
11
That makes perfect sense...

What is the 2 arg version?
user=> ('{a 10, b 11, c 12} 'b 'c)
11
user=> ('b '{a 10, b 11, c 12} 'c)
11
user=> ('b 'c '{a 10, b 11, c 12})
{a 10, c 12, b 11}
user=> ('d '{a 10, b 11, c 12} 'c)
c

Looks like an if then else version of the map lookup??
ie: (if (%1 %2) (%1 %2) %3)
Is this a special feature of maps in general, such that you can look
up a key but return something else if it doesn't exist?
I hadn't come across it yet, but it sounds useful :)


Regards,
Tim.


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

Reply via email to