Fork me on GitHub
#clojure
<
2018-09-02
>
nsa06:09:07

Good morning, folks. I'm a bit confused about spec. See, I have a protocol, say Datastore. I want to s/fdef protocol methods. And can't figure out how. Could anyone point a finger to any documentation or article on speccing protocols?

mg06:09:20

Can't do it. I've solved this problem in the past by making functions that call down to the protocol and putting specs on those

nsa06:09:42

Yep, already thinking about it. Feels a bit hacky

nsa06:09:49

Thanks for the help!

dominicm12:09:09

How do I provide an Collection<SGR> where SGR is a class in a java library?

alexmiller13:09:38

The generics are erased in the jvm - you can just pass a vector (which is a Collection) of the correct objects and it should work

emilaasa15:09:43

Any standard book recommendations for new clojure programmers? I'm pretty new to FP and totally new to Lisp, I know the JVM and Java fairly well.

dadair15:09:26

Clojure for the Brave and True

yogidevbear15:09:41

Also: - Programming Clojure (3rd edition) - Getting Clojure - Living Clojure

schmee15:09:26

The Joy of Clojure is good for programmers who have some previous experience

emilaasa15:09:29

Thanks everyone! I'll just buy them all and go breadth first.

deliciousowl16:09:06

I'd recommend starting with Clojure for the Brave and true if you don't mind silly puns

馃挴 1
theeternalpulse17:09:50

Clojure brave and true also helps with setting up a development environment in the popular ides as well. I started with it but I find more seriously toned books easier to follow.

emilaasa17:09:44

Oh that does sound good - understanding the development environment is what I'm struggling with most now to be honest.

emilaasa17:09:13

I don't really understand how the repl works to be honest

emccue17:09:15

thats all right

emccue17:09:33

we here in the clojurians slack are ready and willing to break it down

theeternalpulse17:09:34

I'm not sure how it all works myself lol, I treat it like magic. But generally the repl is essentially a shell for clojure, allowing you to execute clojure commands.

val_waeselynck18:09:07

To de-mystify the REPL, you may want to look at this: https://clojure.org/guides/repl/introduction

emilaasa18:09:14

I love demystification!

emilaasa18:09:02

Dang the docs are pretty much answering all my questions - RTFM was the right answer again. Altho I like your way of putting it better @U06GS6P1N :>

馃檪 1
Karol W贸jcik18:09:49

Hello Clojurians 馃槢 I got a shared container of rabbitmq. Bunch of my application uses the container and as a host the containers alias is used (in that case 'rabbitmq'). Of course when I change the host to 'localhost' the connection is successful. My question is how do you handle connecting to the shared container via the REPL? Is there some common strategy to that problem in Clojure world?

Karol W贸jcik18:09:52

I think that I will create a special fn for that case that tries to connect and if errors occurs then try to connect to localhost. And if it fails then app fails 馃槣

noisesmith18:09:28

wouldn't you want to use config so that it knows which host to look for, and publish the port from the container so that you could find it by name even if the two apps aren't on the same container?

valtteri18:09:28

I鈥檓 assuming your REPL is running on the host machine (localhost). One thing you can do is to put something like this into your hosts file

127.0.0.1       rabbitmq
which tells your local machine to resolve hostname 鈥榬abbitmq鈥 to localhost. Then you don鈥檛 need different configuration for your app that runs in docker network.

Karol W贸jcik18:09:42

Ooo great 馃槈

Karol W贸jcik18:09:07

That's something I was looking for 馃檪

valtteri18:09:29

No problem! Btw if you are Mac user you also need to flush your dns cache after adding entry to hosts

Karol W贸jcik18:09:23

One more time thanks for sharing the knowledge 馃槈

馃憤 1
Karol W贸jcik18:09:51

@noisesmith using config is lame 馃槣 because I would have to maintain separate configuration for repl and application.

valtteri18:09:33

Well now you鈥檙e exchanging config for OS-level 鈥榟ack鈥 to apply same rules inside/outside docker. 馃槈 (I do this also myself)

dadair20:09:57

How are people (particularly freelancers/consultants with high project churn/turnover) handling repeated project overhead (e.g., defining user account tables/datomic schemas, authentication workflows, etc)? I鈥檓 beginning to pine for the time-saving convenience of things like meteor add accounts, for the every-project repeated components.