Groups
Groups
Sign in
Groups
Groups
4Clojure
Conversations
About
Send feedback
Help
need hint for "A nil key "
172 views
Skip to first unread message
weiyongq
unread,
Feb 29, 2012, 12:55:22 AM
2/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 4Clojure
"A nil key "
http://www.4clojure.com/problem/134
l look it no Elementary.
Leif
unread,
Feb 29, 2012, 7:40:18 PM
2/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 4Clojure
Hint:
(get {:a nil :b 2} :a)
=> nil ; key found, val = nil
(get {:a nil :b 2} :c)
=> nil ; key NOT found
Your code must somehow handle these two situations differently. I
suggest starting with the docs for Map-related functions:
http://clojure.org/data_structures#Data%20Structures-Maps%20%28IPersistentMap%29-Related%20functions
Good luck,
Leif
kaoD
unread,
Apr 29, 2012, 3:35:58 PM
4/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 4Clojure
And I suggest forgetting about map (what?) and just read this:
http://clojuredocs.org/clojure_core/clojure.core/get
kaoD
unread,
Apr 29, 2012, 3:36:58 PM
4/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 4Clojure
Oh sorry, misunderstood map as the function, not the data structure :)
Reply all
Reply to author
Forward
0 new messages