Can someone help me with the following please: I am new to clojure and i haven't developed in 4 years, previous was mainframe. See questions in blue
; Task is to add full state name based on st_abbr (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"} {:st_abbrev "FL", :firstname "roy", :lastname "wills"} {:st_abbrev "OH", :firstname "jay", :lastname "louis"}]) *Question 1: How do I make these between the lines into one Defn?* ----------------------------------------------------------------------- (def get-state (#(map :st_abbrev input-file))) #'user/get-state ("AZ" "FL" "OH") (defn state-desc [get-state input-file] (let [desc get-state] (case desc "AZ" (assoc input-file :state "Arizona") "FL" (assoc input-file :state "Florida") "OH" (assoc input-file :state "Ohio") "default" ))) (map state-desc get-state input-file) #'user/state-desc ({:st_abbrev "AZ", :firstname "john", :lastname "smith", :state "Arizona"} {:st_abbrev "FL", :firstname "roy", :lastname "wills", :state "Florida"} {:st_abbrev "OH", :firstname "ja y", :lastname "louis", :state "Ohio"}) --------------------------------------------------------------------------- Question 2: I tried to combine in one defn, but it's not working, any help would be appreciated (defn state-desc2 [input-file] (let [desc2 (#(map :st_abbrev input-file))] (case desc2 "AZ" (assoc input-file :state "Arizona") "FL" (assoc input-file :state "Florida") "OH" (assoc input-file :state "Ohio") "default" ))) (map state-desc2 input-file) #'user/state-desc2 ("default" "default" "default") -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.