Fork me on GitHub

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?


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


Yep, already thinking about it. Feels a bit hacky


Thanks for the help!


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

Alex Miller (Clojure team)13: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


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.


Clojure for the Brave and True


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


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


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


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

馃挴 4

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.


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


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


thats all right


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


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.


To de-mystify the REPL, you may want to look at this:


I love demystification!


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 :>

馃檪 4
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 馃槣


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?


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       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 馃檪


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 馃槈

馃憤 4
Karol W贸jcik18:09:51

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


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


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.