That's true, I did end up using the Calendar methods since they aren't deprecated and are more intuitive. I can still see the bean being useful for destructuring other Java objects though, Date is a bad example I suppose.
On Wednesday, August 10, 2016 at 6:50:05 PM UTC-6, Karsten Schmidt wrote: > > It's useful, true, but also about 220x slower than writing a dedicated > helper fn (plus java.util.Date's bean accessors are pretty useless > (:year = year - 1900, :day = day of week, :date = day of month). I > wouldn't use `bean` if you have to deal with lots of dates... > > (defn inst->map > [^Calendar t] > {:year (.get t Calendar/YEAR :month (.get Calendar/MONTH) :day (.get > Calendar/DAY_OF_MONTH)}) > > > On 10 August 2016 at 19:05, Jacob Strength <mypc...@gmail.com > <javascript:>> wrote: > > Thank you, that is really helpful! > > > > On Wednesday, August 10, 2016 at 11:29:52 AM UTC-6, Toby Crawley wrote: > >> > >> clojure.core/bean (https://clojuredocs.org/clojure.core/bean) is what > you > >> want: > >> > >> (let [{:keys [day month year]} (bean some-date)] > >> ...) > >> > >> On Wed, Aug 10, 2016 at 12:41 PM, Jacob Strength <mypc...@gmail.com> > >> wrote: > >> > I'm just curious if it is possible to destructure a date object in > say a > >> > let > >> > form? > >> > For example can I do something like this: > >> > (let [{:keys [day month year]} some-date] > >> > ...) > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "Clojure" group. > >> > To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com. > >> > For more options, visit https://groups.google.com/d/optout. > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com > <javascript:> > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > 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+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Karsten Schmidt > http://postspectacular.com | http://thi.ng | http://toxiclibs.org > -- 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.