This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-23
Channels
- # babashka (68)
- # beginners (133)
- # calva (5)
- # chlorine-clover (21)
- # cider (40)
- # clj-kondo (42)
- # cljs-dev (31)
- # clojure (53)
- # clojure-austin (1)
- # clojure-europe (30)
- # clojure-italy (6)
- # clojure-nl (3)
- # clojure-uk (104)
- # clojurescript (15)
- # datascript (2)
- # datomic (50)
- # emacs (12)
- # fulcro (82)
- # graalvm (4)
- # hoplon (225)
- # jobs (4)
- # jobs-discuss (7)
- # joker (5)
- # juxt (17)
- # kaocha (13)
- # leiningen (16)
- # meander (21)
- # nrepl (18)
- # off-topic (16)
- # pathom (8)
- # pedestal (13)
- # perun (1)
- # re-frame (4)
- # spacemacs (23)
- # testing (28)
- # unrepl (3)
- # vim (5)
- # xtdb (1)
Hi. Is there a performance or another difference between core.set
and into #{}
? Their implementations are different but it boils down to reduce, it seems.
(set coll)
is preferred over (into #{} coll)
But they do the same thing (both create a set and inserts elements on it, using transients when available )
Doesn't set
skip the work if it's already a set, whereas into
does the work regardless?
I don't think you should worry about that kind of thing ATM. I would only change from one to another if I had a real application problem if it showed a performance problem
If I want to distinguish between lists/vectors/sets on the one hand and maps on the other hand, is there a predicate that fits better than (complement map?)
. What I'm after is something that conveys many-ness as in something like this:
(if (not (map? foo))
(map bar foo)
(bar foo))
where if foo
is a list/vector/set I'd like to map
bar
over it, but if it's a map?
, I'd just like to call bar
on itno better pred. why not just remove the not and flip the clauses?
or you could
(if-not (map? foo)
(map bar foo)
(bar foo))
Clojure records are remarkably similar to Java records (not a coincidence I think) so if you want them, I'd just use Clojure records
@alexmiller I just wanted to play around with them, not use them for anything
I suspect that since records are mostly a compiler construct (they emit classes that must extend a special type, and have other special flags in the class files), you would need an ASM that supports Java 14 to properly emit these classes
so it's probably not possible to make them with Clojure class construction in current Clojure
but I have not closely inspected the bytecode to know for sure
this blog post has some javap output on them: https://dzone.com/articles/a-first-look-at-records-in-java-14
the object methods are implemented with invokedynamic, which you won't get out of the clojure compiler right now
I mean with some small changes, Clojure's records could probably be Java records
given that Java is planning to build things like destructuring on top of these down the line, that might be worthwhile (can't say it would do much right now afaict)
yeah, I was thinking about future interop with them too, but since they're not final it's a bit early for supporting them anyway in Clojure
way too early, unlikely we will do anything about these for years
from an interop perspective, there's nothing new here - you're still just accessing fields/methods/constructors etc
being able to make any possible class is a non-goal of gen-class or the other clojure class generation facilities
future Java libraries might require you to provide your own records though, which could be a possible interop use-case
possibly, but the whole deal with records is they're just classes
until there is syntax built on it, I don't think it's critical. the whole "special extension of a concrete class", bleh.
clojure records have unboxed fields for doubles and longs
I haven't looked in a few months, but what are people doing with Github Actions for Clojure? specifically w/ tools.deps
I've only recently started using Actions, but I've used this one with a couple of recent small projects and it seems to work well. https://github.com/DeLaGuardo/setup-clojure
We have a really simple action for meander using tools deps. https://github.com/noprompt/meander/blob/5096ff2e939d087abea7a9087a258e8809cf1482/.github/workflows/meander.yml
@ghadi example: if commit contains tag then Github Actions can make: build, test, deploy release to clojars. No external CI/CD.
I have a homerolled thing that builds a jar and drops it into S3, but I want to get rid of the homerolled part
@ghadi @mike1452 yes, you can use my ready solution https://github.com/kwladyka/form-validator-cljs/blob/master/.github/workflows/clojars.yaml keep in mind you have to prepare https://github.com/kwladyka/form-validator-cljs/blob/master/pom.xml with a few details about your project
Any resources for Clojure jobs? Unfortunately some of us are losing jobs because of the "situation".
There are #jobs and #remote-jobs channels -- plus #jobs-discuss for discussion of jobs and resources.