In this case, I think the git repo <https://github.com/joyofclojure/book-source/blob/b76ef15248dac88c7b1c77c2d461f3aa522a1461/src/clj/joy/multimethods.clj#L82> has correct code where the book does not; "clang" instead of "gcc":
(defmethod compile-cmd [::osx "gcc"] [m] (str "/usr/bin/" (get m :c-compiler))) ...should instead be... (defmethod compile-cmd [::osx "clang"] [m] ;; Match the vector exactly (str "/usr/bin/" (get m :c-compiler))) On Tuesday, May 20, 2014 at 11:06:09 PM UTC-4 JD wrote: > This did it Greg, > > Thanks a lot. > > > On Wednesday, May 21, 2014 2:18:08 AM UTC+9, Greg D wrote: >> >> Yes, the examples in the book are missing some lines. I think the >> following log shows what they were going for: >> >> joy.udp=> (remove-method compiler ::osx) >> joy.udp=> (def unix (into unix {::c-compiler "/usr/bin/gcc"})) >> joy.udp=> (def osx (into osx {:c-compiler "gcc"})) >> oy.udp=> osx >> {:home "/Users", :llvm-compiler "clang", :os :joy.udp/osx, >> :joy.udp/prototype {:home "/home", :os :joy.udp/unix, :c-compiler "cc", >> :dev "/dev"}, :c-compiler "gcc"} >> joy.udp=> unix >> {:home "/home", :joy.udp/c-compiler "/usr/bin/gcc", :os :joy.udp/unix, >> :c-compiler "cc", :dev "/dev"} >> joy.udp=> (compiler osx) >> "gcc" >> joy.udp=> (compile-cmd osx) >> "/usr/bin/gcc" >> >> About your question: >> >>> Isn't there a core function/macro where I can derive and set hierarchy >>> all at once? >>> >> Such a function would need to know in advance what hierarchy you want to >> construct. If you have a desired pattern of hierarchy that you want to >> reuse, you could define a function to create it using "derive" and >> optionally "make-hierarchy". >> >> >> On Monday, May 19, 2014 4:38:00 PM UTC-7, gamma235 wrote: >>> >>> I actually just wanna know why I need to use derive so many times. Isn't >>> there a core function/macro where I can derive and set hierarchy all at >>> once? I'm just looking for a more efficient way. My bad for not stating >>> that more clearly in the original post. >>> >>> The real problem though is the last two calls to compile-cmd. I've been >>> messing with it for a couple of days so any help there would be well >>> appreciated. >>> >>> Thanks >>> >>> J >>> >>> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/f4e8b3e6-f521-4cbc-83e2-859e6016110en%40googlegroups.com.