; I have these records defined

(defrecord Customer [firstName lastName emailAddress deliveryAddress 
invoiceAddress])
(defrecord Address [street number town postcode])

; I have this small sample data
(def customers
  {
    (->Customer "Drongo" "Bongo" "dro...@bongo.co"
      (->Address "Gongo" "32A" "Fongo" 8888)
      (->Address "Gongo" "32B" "Fongo" 1111))

      (->Customer "Tinga" "Zinga" "qi...@zinga.co"
        (->Address "Thinga" "767" "Dongo" 2222)
        (->Address "Jinga" "828" "Qongo" 3333))
    }
)

; and I want a small filter on an embedded property (deliveryAddress.number)
; this compiles but of course it's wrong so gives back an empty list

(prn (filter #(= "32A" (:deliveryAddress :number %)) customers))

I have tried putting -> and [] in various places and of course checked docs

In the end I thought it would be quicker just to ask here.

Thanks

Ray

 

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