On Thu, Jan 21, 2010 at 7:57 AM, Jacek Generowicz <jacek.generow...@googlemail.com> wrote: > Clojure has a Ratio type; presumably there should be an easy way to > find the numerator and denominator of a Ratio object. > > I didn't have much luck on clojure.org or with find-doc, but > > (show 1/2) > > taught me that there are numerator and denominator methods on Ratio's > underlying Java implementation, so I can now do: > > (.numerator 1/2) ; => 1 > (.denominator 1/2) ; => 2 > > Is there a more direct way? (Not that this is bad! But you can't > use .numerator as a first-order function (though #(.numerator %) is > still pretty damn good).) > > In general, do you have any hints on how to go about looking for > useful Clojure functions which work with certain Clojure types ? >
I'd welcome a patch that exposed these methods as functions in core. Rich -- 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