This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (35)
- # announcements (2)
- # arachne (1)
- # beginners (71)
- # chestnut (2)
- # cider (100)
- # cljdoc (17)
- # cljs-dev (17)
- # cljsjs (2)
- # cljsrn (2)
- # clojure (53)
- # clojure-austin (2)
- # clojure-europe (1)
- # clojure-finland (2)
- # clojure-italy (3)
- # clojure-nl (7)
- # clojure-russia (56)
- # clojure-spec (56)
- # clojure-uk (35)
- # clojurescript (58)
- # community-development (14)
- # core-async (9)
- # cursive (22)
- # data-science (5)
- # datomic (14)
- # duct (5)
- # emacs (2)
- # expound (4)
- # figwheel-main (6)
- # fulcro (23)
- # kaocha (8)
- # lumo (7)
- # off-topic (10)
- # pathom (6)
- # re-frame (17)
- # reitit (31)
- # ring (3)
- # rum (1)
- # shadow-cljs (45)
- # spacemacs (10)
- # sql (12)
- # testing (9)
- # tools-deps (130)
I mean, lazy evaluation is not something you should have to consider constantly, but you do need to know about it.
The biggest gotcha is probably with side effects. For example,
(map print [1 2 3]) — works in the REPL, won’t work in the middle of a fn.
(Integer. "123") and
(Integer/parseInt "123") do exactly the same thing. You can confirm this in the Java source code.
4) I understood the logic 🙂 I thought about skipping it entirely, but it’s good to know that you can use existing clojure fns as a starting point for what you need to do.
duplicates gets used quite a bit. I even introduced it into my professional code base not long ago and have used it multiple times there.
5) Yeah cursive inserts the ns require for me. I really don’t know anything about Cider.
You must require namespaces before you use them. You got lucky because
clojure.string is brought in by
This is kind of a gotcha at the REPL, because things like
clojure.pprint get required on REPL startup but not on
5.b) Yeah the bottom right is a REPL buffer. I don’t use it very often, but it can be nice for small one-off forms.
I’m glad you found it helpful! I’m more than happy to continue answering questions here. My only other thought would be reddit so people could search it via google later. Feel free to post a link/links and have discussion there if you like.
This was all great information folks, thank you!
Integer. is out.
parse... is my new best friend
I also like that defaulting to
Long/parseLong because it's the clojure default. I think I found that
Integer. method on an old stackoverflow answer
potetm mentioned above that he uses
Long/parseLong but between those two he would choose
parseLong by default since that is what clojure uses.
oh the default integer type for clojure. gotcha 👍. ( I was confused by what you meant by clojure default)
Longs are 64 bits and therefore in memory are much larger. The increased width can handle a larger range of values
cool. I'm still in the newbie wonderment phase trying to grasp just how fast computers run all these damn calculations. It spits out the answer for that part2 problem we were discussing immediately. so fast.
There was someone solving
ALL solutions in some milliseconds if I remember correctly, in C