Fork me on GitHub
#clojure-uk
<
2019-03-05
>
3Jane06:03:12

...because outgroup is always neighbours/similar enough. People do love to stratify themselves, don’t they.

thomas08:03:38

I managed to exhaust the number of threads I can create on Mac OS X.... 😞

guy10:03:34

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. 😅

👍 16
Ben Hammond11:03:16

also works when you use the map as IFn

({:b 12} :a "something else")

guy11:03:14

Nice one!

dominicm13:03:09

It doesn't use get iirc. Someone showed that :a has a faster implementation. maybe the spectre guys?

Ben Hammond13:03:03

public class Keyword implements IFn, Comparable, Named, Serializable, IHashEq {

Ben Hammond13:03:30

public abstract class APersistentMap extends AFn implements IPersistentMap, Map, Iterable, Serializable, MapEquivalence, IHashEq {

Ben Hammond13:03:08

they are just showing their public interface IFn extends Callable, Runnable{ side

Ben Hammond13:03:15

both of those hook directly into ILookup/valAt

Ben Hammond13:03:09

as does get; but with one extra function call in between

Ben Hammond13:03:37

but if you are that performance sensitive you probably ought to be using a record

dominicm13:03:54

Doesn't bother me :) it's just an interesting tidbit, I assumed the same when I observed the behaviour.

guy13:03:16

So what is RT.get then? I thought RT meant runtime :thinking_face:

Ben Hammond14:03:25

that are useful at runtime

guy14:03:33

Yeah but to me

guy14:03:45

RT.get is what clojure get uses no?

guy14:03:03

so if keyword uses RT.get

guy14:03:21

thats the same as clojure get :thinking_face:

guy14:03:32

🤷 im probs just getting it confused haha

Ben Hammond14:03:19

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 used

Ben Hammond14:03:32

otherwise I agree with you

Ben Hammond14:03:13

so what doesn't implement ILookup, that you are likely to call a Keyword on

Ben Hammond14:03:34

offhand I'm not sure

Ben Hammond14:03:53

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}

guy15:03:50

nice thanks!

agile_geek13:03:37

Bore da (UGT before someone points out it should be 'Prynhawn Da') welsh_flag

yogidevbear14:03:19

I finally got round to installer Joker (linter). It's pretty nice

👍 15
practicalli-johnny16:03:35

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

👍 5
manas_marthi14:03:41

Hi All, need a small info. What is the community choice API for using Selenium webdriver ?

thomas15:03:21

At work we use Selenide on top of selenium, very declarative, but still java.

thomas15:03:34

there is a Clojure implementation of the webdriver...

thomas15:03:15

I have never used it though, but I would like to give it a try.

thomas15:03:56

and I have no idea what other people are using.

manas_marthi15:03:33

I just tried etaoin, it does not support IE. So, does not work for me..

manas_marthi15:03:48

Searching for other options on github..

Wes Hall15:03:23

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?

guy15:03:39

I’ve used https://github.com/RickMoynihan/lein-tools-deps before, if u want a halfway house

guy15:03:57

So we end up with a project.clj and a deps.edn

guy15:03:19

and you basically omit the :dependencies from project.clj etc

Wes Hall15:03:26

Any reason why you need both?

guy15:03:52

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.

Wes Hall16:03:23

Cool, thanks mate.

👍 5
hugo16:03:18

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.

thomas15:03:31

@seancorfield has switched over... (or is in the process of switching over)

seancorfield15:03:41

We switched completely from Boot to CLI/`deps.edn` last year. We've been very happy with it.

seancorfield15:03:18

We use my fork of depstar to build uberjars for production deployment.

seancorfield15:03:10

All our Boot tasks just became regular Clojure functions in dev/build namespaces.

Wes Hall16:03:00

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.

seancorfield16:03:43

Happy to answer any questions you have. We have a big monorepo with a lot of subprojects -- 90,000 lines.

Wes Hall16:03:10

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.

dominicm16:03:33

@wesley.hall check out edge, it's JUXT's starting point for all projects.

Wes Hall16:03:04

@dominicm Excellent. Got it open in a tab right now. Will dive in. Thanks.

flefik16:03:41

@seancorfield how do you manage shared dependencies across your monorepo?

flefik16:03:07

do you have 1 deps.edn or do you have multiple ones with overlapping dependencies?

flefik16:03:17

or references across deps files?

Ben Hammond16:03:09

well it depends on how your project evolves

Ben Hammond16:03:34

deps is really good at managing shared libaries that are not-quite-finished

Ben Hammond16:03:47

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

Ben Hammond16:03:59

re deps.edn: its got the notion of aliases with are switches you can toggle to turn dev libraries on and off, etc

Ben Hammond16:03:29

BUT IT ONLY USES THE ALIASES IN THE TOP LEVEL PROJECT;

Ben Hammond16:03:20

if you have got a hierarchy of deps file dependencies, each with its own 'aliases' expectations

Ben Hammond16:03:43

then you'll find that its not gonna work

flefik16:03:01

yeah we never really got it working nicely so we’re still stuck in boot land

Ben Hammond16:03:45

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

Ben Hammond16:03:11

but its an unpleasant surprise if you are not expecting it

Ben Hammond16:03:45

otherwise its great

flefik16:03:00

good to know thanks!

seancorfield17:03:52

We have a fake "subproject" called versions with a deps.edn file that we use as the "user" file via CLJ_CONFIG=

seancorfield17:03:58

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.

seancorfield17:03:29

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.

thomas20:03:04

I keep running into unable to create new native thread error message... and my ulimit -n is set at 65535.... :thinking_face:

thomas20:03:28

and this is when I run with +5K clients.

thomas20:03:39

which on its own isn't bad IMHO.

dominicm21:03:28

Pancakes were fun :)