need hint for "A nil key "

172 views
Skip to first unread message

weiyongq

unread,
Feb 29, 2012, 12:55:22 AM2/29/12
to 4Clojure
"A nil key "
http://www.4clojure.com/problem/134

l look it no Elementary.

Leif

unread,
Feb 29, 2012, 7:40:18 PM2/29/12
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 PM4/29/12
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 PM4/29/12
to 4Clojure
Oh sorry, misunderstood map as the function, not the data structure :)
Reply all
Reply to author
Forward
0 new messages