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]
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, Ja
Nice! I didn't know you could that!
On Wed, Aug 10, 2016 at 5:29 PM, 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
> 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 wrote:
> I'm just curious if it is possible to destructure a date object in say a let
> form?
> For example can
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 e