admin-announcements

Announcements from the Clojurians Admin Team (@U11BV7MTK @U077BEWNQ @U050TNB9F @U0ETXRFEW @U04V70XH6 @U8MJBRSR5 and others)
2015-12-18T15:34:43.002110Z

Neat! TIL: the :as keyword in Clojure's destructuring allows recursive destructuring.

((fn [[[x1 y1] [x2 y2] :as [c1 c2 :as cs]]] {:x1 x1 :y1 y1 :x2 x2 :y2 y2 :c1 c1 :c2 c2 :cs cs}) [[1 2] [3 4]])
outputs
{:x1 1, :y1 2, :x2 3, :y2 4, :c1 [1 2], :c2 [3 4], :cs [[1 2] [3 4]]}

🦜 9
alexmiller 2015-12-18T15:36:36.002111Z

that's pretty wild

😊 1
bostonaholic 2015-12-18T15:44:04.002112Z

arronmabrey++

😊 1
2015-12-18T18:20:38.002117Z

isn't that the same as [[x1 y1 :as c1] [x2 y2 :as c2] :as cs]?

2015-12-18T18:52:15.002119Z

@gfredericks: yup, I get the same output with that as well. It just goes to show how flexible Clojure's destructuring is.

samflores 2015-12-18T19:19:59.002120Z

I've never thought of using anything but a symbol after the :as. That's pretty awesome

sveri 2015-12-18T19:52:04.002121Z

Hi, using cheshire, is there a way to decode json with a date string and convert it to the Date. object?

akiva 2015-12-18T20:18:25.002123Z

@sveri, check out https://github.com/clj-time/clj-time.

jaen 2015-12-18T20:18:55.002125Z

@sveri: schema + coercions maybe?

jaen 2015-12-18T20:20:22.002126Z

@sveri: you can look around a thing I've done for university, I had to solve this exact thing. It's mostly contained to this directory - https://github.com/jaen/panda-5/tree/master/src/panda_5/api.

jaen 2015-12-18T20:20:37.002129Z

Basically set up schemas and then set up coercions.

2015-12-18T20:55:26.002130Z

http://github.com/gfredericks/schema-bijections is an alternative approach