This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-02
Channels
- # announcements (3)
- # asami (29)
- # babashka (62)
- # beginners (131)
- # biff (7)
- # calva (31)
- # cider (5)
- # clerk (14)
- # clj-kondo (3)
- # cljsrn (12)
- # clojars (18)
- # clojure (72)
- # clojure-austin (17)
- # clojure-dev (6)
- # clojure-europe (31)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-sweden (11)
- # clojure-uk (6)
- # clr (47)
- # conjure (42)
- # cursive (88)
- # datalevin (2)
- # datomic (25)
- # emacs (42)
- # exercism (1)
- # fulcro (10)
- # funcool (8)
- # gratitude (2)
- # honeysql (16)
- # introduce-yourself (5)
- # jobs-discuss (26)
- # leiningen (5)
- # lsp (31)
- # malli (21)
- # matcher-combinators (14)
- # missionary (2)
- # nbb (1)
- # off-topic (40)
- # pathom (38)
- # portal (2)
- # re-frame (7)
- # reagent (18)
- # reitit (1)
- # releases (5)
- # shadow-cljs (62)
- # sql (12)
- # testing (4)
- # xtdb (37)
The thing about going through every single of line code--
In the definition LongChunk
we see
public Object nth(int i){
return start + (i * step);
}
public Object nth(int i, Object notFound){
if(i >= 0 && i < count)
return start + (i * step);
return notFound;
}
This allows nth(int)
to return a value even when out of range, either negative or way past the end of the range. Should it throw an exception in such cases? Or shall we just let it be giddy with power? (I believe the latter is forbidden by the comment on clojure.core/nth
: "if index out of bounds, ... nth throws an exception unless not-found is supplied"One reason I ask is I'm not sure if LongChunk.nth(int)
every surfaces through to clojure.core/nth
.
I don't think this is user exposed (ie not connected to clojure.core/nth)
it's definitely not user exposed, but I would need to review how chunks are used to see if it's sufficiently guarded
this is only used internally and guarded by the chunk count, so don't think it's an issue