This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-06
Channels
- # announcements (1)
- # babashka (118)
- # beginners (108)
- # calva (20)
- # chlorine-clover (3)
- # clara (10)
- # clj-kondo (47)
- # cljsrn (10)
- # clojure (144)
- # clojure-australia (5)
- # clojure-czech (2)
- # clojure-dev (11)
- # clojure-europe (94)
- # clojure-france (4)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-sweden (2)
- # clojure-uk (11)
- # clojuredesign-podcast (5)
- # clojurescript (56)
- # cloverage (1)
- # code-reviews (6)
- # conjure (1)
- # cursive (13)
- # datascript (1)
- # datomic (16)
- # defnpodcast (1)
- # emacs (1)
- # etaoin (1)
- # events (7)
- # fulcro (21)
- # graalvm (3)
- # helix (17)
- # jackdaw (3)
- # jobs-discuss (2)
- # lambdaisland (2)
- # london-clojurians (2)
- # meander (2)
- # mid-cities-meetup (2)
- # midje (1)
- # off-topic (1)
- # pathom (3)
- # pedestal (12)
- # reagent (7)
- # reitit (15)
- # reveal (12)
- # shadow-cljs (6)
- # sql (14)
- # test-check (3)
- # vim (13)
has broken.
Bore da
@otfrom I’m using hx for the view layer, and my own reseda library for the state. https://github.com/lilactown/hx https://github.com/orestis/reseda
If anyone is interested, for those following the major.minor.commits approach to tagging repos, I've put together a very simple script to help do that. I use it on my clojure stuff all the time (with a slight variation, I prefix my versions with a rel/
)....
@otfrom https://twitter.com/borkdude/status/863792981198995456 (including nice comment by Ray!)
I do like monoids.
But I’ve also studied math.
https://clojuredocs.org/clojure.core.reducers/monoid is a fascinating fn
@borkdude one could argue that maps form a monoid under merge with nil as the identity since
user> (merge nil)
;; => nil
user> (merge)
;; => nil
user> (merge {})
;; => {}
user> (merge {} nil)
;; => {}
user> (merge nil {})
;; => {}
user>
Monoids are just a very simple thing with a fancy name which makes people think they're smart when using it :)
monoids are a datastructure + an operation + an identity element, not one or the other without any given context
Event though (conj)
=> []
, so it somewhat presents an identity value, it doesn't seem to form a monoid with []
as an identity value.
Another (not really) interesting thing:
user> (clojure.repl/doc merge)
-------------------------
clojure.core/merge
([& maps])
Returns a map that consists of the rest of the maps conj-ed onto
the first. If a key occurs in more than one map, the mapping from
the latter (left-to-right) will be the mapping in the result.
;; => nil
user> (merge nil)
;; => nil
user> (map? nil)
;; => false
user>
What I'm getting at is that some things are pretty ad hoc in Clojure based on their class. Take contains?
for example. Did you know that thing worked on String
?
What I find interesting with the typed fp folks is that they have their types and their "laws"
The "laws" are the things that the type-system can't help them with. It's where they have to retort to unit-tests
Kind'a makes sense since Clojure is written pre-protocols and you can't extend interfaces to existing java-classes.
I've been told by Alex: please don't use seq on a string, but str/foobar
(e.g. str/blank?). It's just not an good idea to marshall a thing into some other object and then call some function on that which looks up if it's a string again, etc. All that waste of time
the thing with strings being seqables is that it leads to awkward core specs. like many functions take seqables, except strings
But then maybe the problem is that the fns that take seqables should have accepted strings?
I mean, a string is just a sequence of characters so why bother implementing specific fns for it?
so nil is seqable? but can also be many other things. this annoyed me when creating the type system in clj-kondo, since it checks if something could have been of a certain type, so if something is nilable, it could have been a seqable....
btw @slipset, the type system in clj-kondo heavily borrowed from our core spec project :)

@slipset See https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/types/clojure/core.clj A lot of this resembles the speculative specs