This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-17
Channels
- # announcements (17)
- # aws (2)
- # babashka (21)
- # beginners (67)
- # calva (19)
- # cider (29)
- # clara (3)
- # clj-kondo (6)
- # cljsrn (10)
- # clojure (140)
- # clojure-europe (164)
- # clojure-nl (3)
- # clojure-uk (8)
- # clojurescript (62)
- # conjure (7)
- # core-async (24)
- # cursive (21)
- # datomic (5)
- # docker (40)
- # emacs (14)
- # fulcro (25)
- # gratitude (1)
- # honeysql (6)
- # introduce-yourself (1)
- # jobs (1)
- # jobs-discuss (32)
- # juxt (7)
- # lsp (13)
- # minecraft (2)
- # off-topic (49)
- # pathom (24)
- # practicalli (8)
- # re-frame (18)
- # react (23)
- # remote-jobs (6)
- # reveal (2)
- # shadow-cljs (75)
- # tools-deps (7)
If I have a time, and an interval, is there an existing function to determine if that time resides within (is contained by) the interval?
Are tick interval bounds inclusive, or exclusive, or some mixture?
For example org.threeten.extra.Interval
An interval represents the time on the time-line between two Instants.
The class stores the start and end instants, with the start inclusive and the end exclusive.
The end instant is always greater than or equal to the start instant.
@dcj The relation can tell you https://www.juxt.land/tick/docs/index.html#_intervals
I am getting 404s on this: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjfipWEqobzAhWXGDQIHcPxBH4QFnoECCAQAQ&url=https%3A%2F%2Fwww.juxt.land%2Ftick%2Fdocs%2Findex.html&usg=AOvVaw3Edq3vBf2wNUR9uPlKknWr
WRT "Are tick interval bounds inclusive or exclusive?" According to the docs:
(= (t.i/new-interval (t/date-time "2000-01-01T00:00")
(t/date-time "2001-01-01T00:00"))
(t.i/bounds (t/year 2000))
{:tick/beginning (t/date-time "2000-01-01T00:00")
:tick/end (t/date-time "2001-01-01T00:00")})
And
(t/in (t/bounds (t/today)) "US/Pacific")
#:tick{:beginning
#time/zoned-date-time "2021-09-17T00:00-07:00[US/Pacific]",
:end
#time/zoned-date-time "2021-09-18T00:00-07:00[US/Pacific]"}
This leads me to conclude that the :tick/beginning
bound is inclusive, and :tick/end
is exclusive, anyone disagree???WRT "how to determine if a time resides within (is contained by) an interval", seems like this would work:
(defn contained-by-interval?
[t {:keys [tick/beginning tick/end] :as i}]
(and (t/<= beginning t) (t/< t end)))
The tick docs have been temporarily taken down as they are out of date and the place they were being hosted has some issues. You can access up to date ones here for now (or of course see the repo) https://festive-haibt-f050e6.netlify.app/