This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-05
Channels
- # aleph (90)
- # announcements (4)
- # aws (2)
- # beginners (61)
- # calva (2)
- # cljs-dev (8)
- # cljsrn (12)
- # clojars (4)
- # clojure (42)
- # clojure-europe (1)
- # clojure-finland (1)
- # clojure-greece (2)
- # clojure-houston (1)
- # clojure-italy (3)
- # clojure-nl (30)
- # clojure-spec (41)
- # clojure-uk (87)
- # clojurescript (44)
- # cursive (12)
- # data-science (11)
- # datomic (24)
- # defnpodcast (1)
- # fulcro (18)
- # hyperfiddle (1)
- # jobs (2)
- # juxt (11)
- # kaocha (3)
- # london-clojurians (5)
- # mount (2)
- # nrepl (2)
- # off-topic (9)
- # onyx (25)
- # other-languages (1)
- # parinfer (3)
- # pathom (5)
- # pedestal (3)
- # portkey (1)
- # re-frame (21)
- # reagent (24)
- # remote-jobs (7)
- # schema (2)
- # shadow-cljs (59)
- # spacemacs (5)
- # specter (7)
- # sql (9)
- # tools-deps (13)
...because outgroup is always neighbours/similar enough. People do love to stratify themselves, don’t they.
Morning
Morning
Today I learnt:
(get {:b 12} :a "something else")
=> "something else"
(:a {:b 12} "something else")
=> "something else"
That a keyword just uses get
under the hood when you pass it another arg as a notFound option.
😅also works when you use the map as IFn
({:b 12} :a "something else")
It doesn't use get
iirc. Someone showed that :a
has a faster implementation. maybe the spectre guys?
public class Keyword implements IFn, Comparable, Named, Serializable, IHashEq {
public abstract class APersistentMap extends AFn implements IPersistentMap, Map, Iterable, Serializable, MapEquivalence, IHashEq {
they are just showing their public interface IFn extends Callable, Runnable{
side
both of those hook directly into ILookup/valAt
as does get
; but with one extra function call in between
but if you are that performance sensitive you probably ought to be using a record
https://github.com/clojure/clojure/blob/9e362e2ee4bf1feb942d31dac821e9d2917789b6/src/jvm/clojure/lang/Keyword.java#L145 @dominicm i assumed that RT.get was get 😞 sorry!
Doesn't bother me :) it's just an interesting tidbit, I assumed the same when I observed the behaviour.
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L754-L817 its just a Java class with a bunch of static functions in it
that are useful at runtime
er yeah, but keyword has a
final public Object invoke(Object obj, Object notFound) {
if(obj instanceof ILookup)
return ((ILookup)obj).valAt(this,notFound);
short circuit
which is more likely to get usedotherwise I agree with you
so what doesn't implement ILookup, that you are likely to call a Keyword on
offhand I'm not sure
A set is one thing
(:this #{:this :that})
=> :this
(:tother #{:this :that})
=> nil
(supers (class #{:this :that}))
=>
#{java.io.Serializable
clojure.lang.IObj
clojure.lang.IEditableCollection
clojure.lang.Seqable
clojure.lang.IPersistentCollection
java.lang.Object
clojure.lang.IFn
java.lang.Runnable
clojure.lang.Counted
java.util.Set
clojure.lang.IPersistentSet
java.lang.Iterable
clojure.lang.AFn
java.util.concurrent.Callable
java.util.Collection
clojure.lang.APersistentSet
clojure.lang.IMeta
clojure.lang.IHashEq}
Bore da (UGT before someone points out it should be 'Prynhawn Da')
I have Joker running continuously in Emacs (Spacemacs) and it does help me pick up little issues straight away. Suggest you add a few common macros and teach joker a bit of syntax it doesnt know. I wrote what I do here: https://practicalli.github.io/spacemacs/improving-code/linting/joker.html
Hi All, need a small info. What is the community choice API for using Selenium webdriver ?
thank you
I just tried etaoin, it does not support IE. So, does not work for me..
Searching for other options on github..
Realising I am a bit behind the curve. Just now getting around to looking into using deps.edn. Anybody fully switched to this as an alternative to the usual suspects (lein, boot), and have success / horror stories?
I’ve used https://github.com/RickMoynihan/lein-tools-deps before, if u want a halfway house
So the main reason was handling deps in a nicer way.
We had a project where the deps were pretty interesting
so by moving to deps it helped pin down exactly what we needed.
Might not be a good reason to use both, but it worked nicely haha.
This was linked in the #clojure channel a few days ago: https://github.com/oakes/full-stack-clj-example which is an example of using cli/deps along with a prod.clj
script that invokes the uberjar functionality of lein for building.
@seancorfield has switched over... (or is in the process of switching over)
We switched completely from Boot to CLI/`deps.edn` last year. We've been very happy with it.
We use my fork of depstar
to build uberjars for production deployment.
All our Boot tasks just became regular Clojure functions in dev/build namespaces.
Excellent, thank you @seancorfield. I actually really like the idea of migrating build logic into "just clojure code", so glad to hear that this works for you. Will definitely continue to investigate.
Happy to answer any questions you have. We have a big monorepo with a lot of subprojects -- 90,000 lines.
Excellent, thanks. Might well take you up on that. One of the things I have been looking for a better solution for is parallel development of applications and libraries. I tend to do this kind of thing a lot and the lein checkouts feature is..... less than perfect. The deps.edn support for simple local dependencies (and git dependencies) coupled with the dependency override mechanism looks like it would be a fairly nice way to handle this. Will definitely have a play with it.
@wesley.hall check out edge, it's JUXT's starting point for all projects.
@seancorfield how do you manage shared dependencies across your monorepo?
well it depends on how your project evolves
deps is really good at managing shared libaries that are not-quite-finished
you just a tree of local deps.edn projects, and they all work together, and you can update any of them and immediately have that change visible withoutt having to publish a SNAPSHOT
re deps.edn
: its got the notion of aliases with are switches you can toggle to turn dev libraries on and off, etc
BUT IT ONLY USES THE ALIASES IN THE TOP LEVEL PROJECT;
if you have got a hierarchy of deps file dependencies, each with its own 'aliases' expectations
then you'll find that its not gonna work
you can work around this by declaring seperate projects for dev, prod, etc, to bring in the correct aliases at the sublevels; and then depend upon them at the top level
but its an unpleasant surprise if you are not expecting it
otherwise its great
We have a fake "subproject" called versions
with a deps.edn
file that we use as the "user" file via CLJ_CONFIG=
So each subproject has a deps.edn
and shared deps are overridden in versions/deps.edn
(via :override-deps
), and then we do
cd subproject
CLJ_CONFIG=../versions clj -A:defaults:what:ever -m as.needed
for whatever we are doing.In the subproject deps.edn
, we try to use {}
as the coords to emphasize the fact that they come from the versions/deps.edn
file and :defaults
is the alias that brings in all the shared/default deps.