Your function objects-at is correct but you have mixed up keywords and
strings in the definitions. Try the following:

(def *objects* '(:bottle :bucket :frog :chain))

(def *object-locations* {:bottle 'living-room, :bucket 'living-room,
:chain 'garden, :frog 'garden})

(defn objects-at [loc objs obj-locs]
  (letfn [(is-obj-at? [obj]
    (= (obj obj-locs) loc))]
  (filter is-obj-at? objs)))

(println (objects-at 'garden *objects* *object-locations*)

-----Original Message-----
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On
Behalf Of HB
Sent: Sunday, March 27, 2011 10:03 PM
To: Clojure
Subject: Why I'm getting an empty result?

Hi,
Would you please have a look at this code:


(def *objects* '(bottle bucket frog chain))

(def *object-locations* {:bottle 'living-room, :bucket 'living-
room, :chain 'garden, :frog 'garden})

(defn objects-at [loc objs obj-locs]
  (letfn [(is-obj-at? [obj]
    (= (obj obj-locs) loc))]
  (filter is-obj-at? objs)))

(println (objects-at :garden *objects* *object-locations*))

Why the result is empty? Shouldn't it be (bottle bucket)?

Thanks for help and time.

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

Reply via email to