This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-09
Channels
- # adventofcode (132)
- # announcements (19)
- # babashka (7)
- # babashka-sci-dev (6)
- # beginners (46)
- # calva (25)
- # chlorine-clover (5)
- # cider (2)
- # clara (17)
- # clj-kondo (93)
- # clojure (2)
- # clojure-dev (4)
- # clojure-europe (12)
- # clojure-losangeles (3)
- # clojure-nl (7)
- # clojure-uk (4)
- # clojurescript (29)
- # conjure (6)
- # core-async (8)
- # cursive (16)
- # data-science (7)
- # datomic (1)
- # exercism (4)
- # figwheel-main (8)
- # fulcro (9)
- # graphql (2)
- # helix (1)
- # introduce-yourself (3)
- # jobs (3)
- # lsp (4)
- # malli (20)
- # minecraft (3)
- # nextjournal (62)
- # off-topic (16)
- # overtone (34)
- # pathom (5)
- # polylith (10)
- # portal (1)
- # re-frame (104)
- # reagent (29)
- # reitit (1)
- # remote-jobs (2)
- # rum (3)
- # shadow-cljs (22)
- # spacemacs (2)
- # sql (10)
- # tools-deps (17)
- # vim (13)
Just sort of shot myself in the foot with Clojure Alpha 3 because of this subtle difference:
dev=> (.longValue (.parse (java.text.NumberFormat/getInstance) "42#"))
42
dev=> (parse-long "42#")
nil
I had no idea that NumberFormat
's parse
method would ignore trailing bad characters. So parse-long
has the correct behavior from my point of view but it uncovered a rather unpleasant bug lurking in one of our web forms 😕I also got an unexpected nil
in some Advent of Code input where there was a trailing newline: (parse-long "1\n")
which manifested as an NPE when something numeric was expected.
I would have been equally surprised by dev=> (.longValue (.parse (java.text.NumberFormat/getInstance) "42\n")) ;=> 42
🙂