Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ZIP!!

kunou
July 13, 2017
170

 ZIP!!

kunou

July 13, 2017
Tweet

Transcript

  1. I❤zip zipのちょっと変わった使い方 (def days [ (t/date-time 2017 7 7) (t/date-time

    2017 7 8) (t/date-time 2017 7 9) (t/date-time 2017 7 11) (t/date-time 2017 7 13)]) こんな感じのvectorがあるとき…… ※clj-time Λ࢖༻
  2. I❤zip zipのちょっと変わった使い方 (def days [ (t/date-time 2017 7 7) (t/date-time

    2017 7 8) (t/date-time 2017 7 9) (t/date-time 2017 7 11) (t/date-time 2017 7 13)]) こんな感じのvectorがあるとき……空いて いる日付が欲しい
  3. I❤zip zipのちょっと変わった使い方 (def days [ (t/date-time 2017 7 7) (t/date-time

    2017 7 8) (t/date-time 2017 7 9) (t/date-time 2017 7 11) (t/date-time 2017 7 13)]) こんな感じのvectorがあるとき……空いて いる日付が欲しい
  4. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1))))
  5. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1)))) => ((2017-07-07 2017-07-08) (2017-07-08 2017-07-09) (2017-07-09 2017-07-11) (2017-07-11 2017-07-13))
  6. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1)))) => ((2017-07-09 2017-07-11) (2017-07-11 2017-07-13))
  7. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1)))) => ((2017-07-09) (2017-07-11))
  8. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1)))) => ((2017-07-10) (2017-07-12))
  9. I❤zip zipのちょっと変わった使い方 (->> (zip days (rest days)) (remove #(let [[x

    y] %] (= (+ (t/day x) 1) (t/day y)))) (map first) (map #(t/plus % (t/days 1)))) => ((2017-07-10) (2017-07-12))