I figured it out. My code is going to compare keywords with non-keywords which will returns false and hence an empty result set from filter function.
On Mar 28, 4:09 am, CuppoJava <patrickli_2...@hotmail.com> wrote: > What exactly does the line > (= (obj obj-locs) loc) > do? > > What is an "obj" exactly? From your code it seems that an obj is going > to be 'bottle or 'bucket. I'm not sure what happens if you treat a > symbol as a function. > > -Patrick > > On Mar 27, 10:02 pm, HB <hubaghd...@gmail.com> wrote: > > > > > 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