This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-27
Channels
- # announcements (11)
- # aws (1)
- # babashka (15)
- # beginners (345)
- # calva (5)
- # chlorine-clover (14)
- # clj-kondo (40)
- # cljfx (30)
- # clojure (174)
- # clojure-australia (6)
- # clojure-europe (64)
- # clojure-france (1)
- # clojure-nl (12)
- # clojure-uk (20)
- # clojurescript (29)
- # conjure (1)
- # core-async (53)
- # cryogen (3)
- # cursive (8)
- # datomic (12)
- # emacs (5)
- # events (4)
- # fulcro (27)
- # graalvm (1)
- # graphql (9)
- # helix (8)
- # keechma (11)
- # london-clojurians (1)
- # malli (12)
- # off-topic (12)
- # pathom (8)
- # portal (1)
- # re-frame (19)
- # reagent (13)
- # reitit (16)
- # ring-swagger (2)
- # sci (38)
- # shadow-cljs (31)
- # spacemacs (3)
- # specter (14)
- # sql (14)
- # tools-deps (31)
- # vim (4)
- # xtdb (9)
I've been wondering why core has all these fns like interleave
, interpose
and other neat sequence functions. To me they seemed, well, neat, but nothing I ever reach for in my day to day work. But then I tried to write a macro, and they made a lot more sense.
Morgen
I used interpose a lot in the past, it's great to generate token (comma, AND, OR etc) separated strings and since it has a transducer arity you can compose with it nicely and "realize" the final thing with a single call to transduce + a string-builder reducing fn
You can do the same with str/join but you loose the ability to do it in a single pass when you need to also work on the values passed to it, think (str/join "," (map tranform xs)) vs (transduce xform string-builder xs), where string-builder and xform can be heavily optimized for what you need to generate
I needed interleave
to process namespace forms and interleave the namespace names with :reload
, so you get:
(ns foo (:require [foo :as f] bar)
=>
(ns foo (:require foo :reload bar :reload)
Good morning!
morning
Another one of those things that feel ok to discuss in here.
user> (= 1 1 1)
;; => true
user> (= 1 1)
;; => true
user> (= 1)
;; => true
user> (=)
Execution error (ArityException) at user/eval73949683 (form-init4579255747461836344.clj:2764).
Wrong number of args (0) passed to: clojure.core/=
I think I'd be happy if =
was two-arity, I'm pleasantly surprised by it being multi-arity, but then again, a bit annoyed that it's not zero-arity.
@slipset We can make a clj-kondo rule that says: don't use varargs comparison: always use reduce
+ an explicit identity ;)
I guess this is the kind of runtime errors I have a hard time accepting, And why I now always use the three-arity reduce
I can handle (runtime) type-errors as they don't crop up too often, but runtime-lack-of-nil-punning sucks.
You could argue that map lookups should always be done with a sentinel-value
(:foo nil :not-found)
(I didn't know how many closing parens I should type, so I just ensured there were enough)
I guess what Zach argues is that when you to a map-lookup on nil
you change the type of nil
, if that makes sense.
< and > aren't less-than or greater-than, they are increasing and decreasing (or at least that is the only way I can remember
I just saw an AWS update that Corretto JDK 11 now supports Shenandoah GC, and it turns out it was backported to JDK11. I wonder if someone has used it with Clojure programs and has any experience report?
I suppose there is this: http://clojure-goes-fast.com/blog/shenandoah-in-production/
Totally unrelated, http://mailbox.org looks great