What is an ival
?
(defn intersects? [ivals interval]
(not-empty (intersection ivals [interval])))
ivals
the example on the docs shows:
(t/intersects? [(t/year)]
(t/inc (t/year)))
Doesn't seem like intersects?
works with a non-interval....
=> t4
#time/zoned-date-time "2020-07-04T00:00-07:00[US/Pacific]"
=> ti
#:tick{:beginning #time/zoned-date-time "2020-07-04T00:00-07:00[US/Pacific]", :end #time/zoned-date-time "2020-07-05T00:00-07:00[US/Pacific]"}
=> (t/intersects? t4 ti)
Execution error (UnsupportedOperationException) at tick.interval/assert-proper-head (interval.cljc:427).
nth not supported on this type: ZonedDateTime
comparing with the reference code I posted, what happens when you add a vector in there (t/intersects? [t4] ti)
Not sure how to interpret this:
=> (t/intersects? [t4] ti)
nil
Also:
=> (t/intersects? [ti] ti)
(#:tick{:beginning #time/zoned-date-time "2020-07-04T00:00-07:00[US/Pacific]", :end #time/zoned-date-time "2020-07-05T00:00-07:00[US/Pacific]"})
I question the use of the question mark at the end of this function name 🙂
The tick versions of >=
etc are variadic just like clojure.core's, so your within?
function could just be:
(t/<= (t/beginning i) time (t/end i))
I'm not sure there is a shorter version than that1😎