This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-08
Channels
- # aws (3)
- # beginners (126)
- # boot (19)
- # cider (31)
- # cljs-dev (324)
- # clojure (96)
- # clojure-boston (2)
- # clojure-denver (9)
- # clojure-dusseldorf (2)
- # clojure-greece (4)
- # clojure-italy (5)
- # clojure-losangeles (1)
- # clojure-spec (18)
- # clojure-uk (59)
- # clojurebridge (1)
- # clojurescript (184)
- # community-development (29)
- # cursive (2)
- # datascript (2)
- # datomic (5)
- # emacs (1)
- # figwheel (6)
- # fulcro (270)
- # hoplon (2)
- # jobs (1)
- # jobs-discuss (1)
- # keyboards (2)
- # leiningen (2)
- # london-clojurians (2)
- # luminus (10)
- # mount (1)
- # off-topic (26)
- # onyx (8)
- # other-languages (1)
- # parinfer (1)
- # protorepl (6)
- # re-frame (23)
- # reagent (61)
- # reitit (5)
- # shadow-cljs (100)
- # spacemacs (3)
- # sql (19)
- # unrepl (90)
- # vim (25)
So I guess I am one of the few who listens to music on my laptop with Bluetooth headphones... good to know
I mean, I do that now. But I know plenty of my colleagues don't. To them, having that there is just a battery drain / potential source of crashes.
Morning
månmån
Random core function of the day:
-------------------------
clojure.core/key
([e])
Returns the key of the map entry.
Guess key
and 'val` are there mainly for interop:
(import '[java.util HashMap])
(map key (HashMap. {:a 1 :b 2}))
Can someone explain the difference to me between these four approaches?
(map key (HashMap. {:a 1 :b 2}))
(map key {:a 1 :b 2})
(keys (HashMap. {:a 1 :b 2}))
(keys {:a 1 :b 2})
I'm guessing that keys
is doing something similar to (map key ...)
under the hood?The output is the same for all four when I run them so curious about the difference and pros/cons inherent in each
@yogidevbear map key
is lazy, keys
is not
@yogidevbear the wrapping with HashMap
was there to showcase key
where first
would not work. But normally, you'd go keys
to get all the keys from a map. (map key)
or (map first)
produces the same list lazily (and maybe there is a decent use case for that, but probably not many).
Cool, thanks for the explanations 👍
So I've started wrapping my code in non-lisp languages in parentheses without thinking 😆
I’ve been writing ocaml for the past 6 months and I still destructure constructors like (Foo x, y)
instead of Foo (x, y)
Found this on Stack Overflow:
user=> (defrecord X [a])
user.X
user=> #user.X {:a 1}
#user.X{:a 1}
I'm rather mortified.@yogidevbear yup, I have done that as well... most confusing was that the Python editor I was using didn't flag it as bad syntax... took quite a bit of time before I found that one.
it’s all logged here https://dev.clojure.org/display/design/defrecord+improvements
> This syntax satisfies the need for a general-purpose Java class construction reader form. However, not all Java classes are considered fully constructed after the use of their constructors. Therefore, serialization support is not provided for any Java classes by default. For instances such as these, Clojure will continue to provide facilities via print-dup in the known ways. So it's a general purpose way to initialize a class? Interesting again.
wow didn't know about the deftype
variant (maybe I've seen it printed, but never payed attention)
what deftype
variant @reborg ?
(deftype Point [x y])
;; user.Point
#user.Point[2 2]
;; #object[user.Point 0x19648c40 "user.Point@19648c40"]
minor value, I always use (Point. 2 2), plus the reader version has quoted arguments (like the defrecord)
actually, how do I get the deftype
to print for serialization, do I need to extend the printer?
PSA: if anyone was considering trying cassandra or DSE on DC/OS - don't bother. leave it a while, unless you enjoy ops catastrophes
@mccraigmccraig sounds like fun
@otfrom it looks like the DSE DC/OS universe package has never seen any serious usage and has a bunch of config problems - it installs ok and runs, but the configuration is screwy... datastax-agent has a fixed -Xmx128m and OOMs when you do any big ops (this can be fixed), the cassandra node containers can't be configured with the required ulimits (this can't easily be fixed afaict), nodetool doesn't work, probably because of some container networking issue
it fools you in to thinking that it's working ok, and then suddenly you find dropping and recreating a few MVs is killing your cluster stone dead!
it would be nice to have DSE run on DC/OS, but i've had enough hassle now and i'm going to deploy it to some naked centos nodes alongside a smaller DC/OS cluster