Fork me on GitHub

Understanding destructuring and all of its many forms is an essential thing to get familiar with from the very beginning

Lone Ranger01:12:53

Clojure is so magic. I'm trying to wrap my head around how clojure can do argument destructuring if it's not even possible in java.

Lone Ranger01:12:22

I'm just going to go ahead and assume it's a pretty efficient operation


@goomba Even if Clojure didn't have it you would be able to write the destructure function yourself and then write a macro for let and fn that wraps the args in your destructure function


Another advantage to Clojure (and lisps in general) is that you can extend it

Lone Ranger02:12:55

@gary: if that doesn't get you hot under the collar I don't know what does.

Lone Ranger02:12:41

(probably says a lot about my love life but I'll save that for #off-topic lol)


@goomba If it's any help, most folks I know who do Clojure for any length of time tend to fall in love with the language 🙂


I remember seeing a blog post about someone implementing Clojure in Thai using macros


For some reason I can't seem to find it

Alex Miller (Clojure team)03:12:30

destructuring is actually pretty straightforward to think about


Clojure west talk too, right?

Alex Miller (Clojure team)03:12:52

just imagine rewriting destructuring as a let, and that’s pretty much what it does


Such a cool project


My gf is still harassing me about writing a library like that except it would be Clojure in long English


def would be "define" etc


It shouldn't be that difficult since there aren't a ton of Clojure functions that are abbreviations


I have an endpoint at '/messages’ that executes a sql query. This endpoint has worked within the past couple of days but today I am receiving this error:

IllegalArgumentException db-spec mount.core.DerefableState@54afee5f is missing a required parameter (jdbc.clj:309)
The google responses for this error are a little vague to me and would appreciate some help if anyone has come across this in the past?


@kyle_schmidt is mount started? Seems that your mount usage is a bit wonky


@alexmiller @shaun-mahood thanks for helping me find that project, it does exactly what I was going to do

Lone Ranger18:12:10

question about the clojure beginner preconference workshop

Lone Ranger18:12:42

personally feel like biggest challenge in taking clojure from small projects to production (and more importantly convincing my company to do so) is setting up the architecture and best practices for incorporating database, web api, and biz logic. Obviously the nuances are important. Does the intro to clojure workshop cover that sort of thing or is it more about writing in Clojure in general?

Alex Miller (Clojure team)19:12:38

I assume you're asking about the workshop prior to the conj

Alex Miller (Clojure team)19:12:02

That workshop is primarily about the syntax and features of Clojure

Alex Miller (Clojure team)20:12:21

We've considered doing something that is more architecture / project based too, but it's problematic in some ways


@goomba I think one of the challenges with that “architecture and best practices” piece is that it changes a lot over time (and it’s also often very tied to your system / company / project).


I find, after five and a half years of production Clojure, that I’m constantly learning new and better ways to structure my applications.

Alex Miller (Clojure team)20:12:16

In particular, we worry a little about picking some set of libs and "endorsing" them as Cognitect as "the" way to make Clojure apps


Yes, that is definitely a concern once you move beyond the Contrib suite of libraries.

Alex Miller (Clojure team)20:12:07

I at least don't think that does or should exist

Lone Ranger20:12:41

I think he means "the" way (should not exist)


Or “the” way to make apps?

Alex Miller (Clojure team)20:12:43

That = a single way to make apps

Alex Miller (Clojure team)20:12:41

There are many answers and many kinds of apps and we should always be open to something new too

Lone Ranger20:12:08

I think maybe what I'm looking for (hopefully) is a little more basic, like how to use lein to manage dependencies, how to set up your project.clj file, those sorts of things

Lone Ranger20:12:40

I'm looking for a more of "this does that" than a "this is what you should do"

Alex Miller (Clojure team)20:12:52

Some of that actually is in the intro workshop


And some of that is covered in the community docs?


@goomba One of the things we found, as our projects grew in complexity, was that Leiningen’s declarative approach was a bit too restrictive and we switched to Boot (about a year ago). There are many, many upsides to that choice but there is also a big downside: with Boot, your build file is “just Clojure code” so there really are very few proscribed ways of dealing with projects.


On the topic of dependencies, we have a central file that specifies the versions of any library that we use in more than one project, and then each project has a deps.edn file containing just the list of (production) dependencies for that project. Our build files read both and replace the version from deps.edn with the one from as needed (we usually put a dummy ”x.y.z” version placeholder in the deps.edn file to signify that it is always overridden).

Lone Ranger20:12:28

Interesting. I'll look into that. Hell I wouldn't even mind a 'hand-tooled' approach, as long as I know what I'm doing. Coming from a Python shop we don't really have any build tools anyway, everything is more or less hand-tooled


That way we can assemble artifacts in any way we want from a number of projects, by sucking in all the deps.edn files and concatenating the dependencies from each.

Lone Ranger20:12:04

Problem is I have no idea what I'm doing yet 😛


Yeah, and it took us a good long while to evolve that approach.

Lone Ranger20:12:50

Adding in ClojureScript seems to take the complexity up a notch due the nature or requiring various cross-compilations


Even with the web apps we’ve built, we’ve taken several approaches over the years and we’re still constantly evolving our own in-house “best practices”.

Lone Ranger20:12:16

Ah, maybe Clojure "devops" is the word I'm looking for


If you’re interested in reading a bit more about the capabilities of Boot and how we use it, check out some of my blog posts

Lone Ranger20:12:24

To make this transition I need to make sure developers can just focus on developing, shouldn't have to worry as much about their code not working because I didn't set up the project right

Lone Ranger20:12:32

beautiful @seancorfield , thank you!


We actually keep boot itself under version control in our repo and have a shell script wrapper tailored for our environment (also under version control).


I'm working through the book "Web Development with Clojure, 2nd Ed", and when I try to run (mount/start #'guestbook.db.core/db) in the nREPL, I get the following error: 'ClassCastException mount.core.DerefableState cannot be cast to clojure.lang.IFn guestbook.db.core/eval30818/fn--30819 (core.clj:8)' Does anyone know what the issue might be? I also had an issue connecting to the nREPL server on port 7000 using "lein repl :connect 7000", so I went with "lein repl" instead, which then worked and connected properly.


This is for a Luminus Web App.


If you did lein repl, it just started up a new REPL, it didn’t connect to your running app (just FYI).


That ClassCastException indicates you are trying to call something that is not a function (instead it’s a DerefableState object.


@mlev what happens if you run (mount/start #'guestbook.config/env)


There is a #luminus channel BTW, in case folks here can’t help (I’ve never used Luminus so my help here will be rather generic).


this is a problem that can be solved generically, the mount library is trying to use a state object as function


the mount/start doesn't specify the valid args, it's just [& args] so it will accept anything and then blow up at runtime


so it might be wanting some context and then the db var, who knows


@seancorfield , thanks I posted to that channel as well 🙂 Maybe it is a more simple issue to start off with. If lein repl does not start it from the same directory at the app, how can I start a repl connected to the app?


The books says >When the application starts in development mode, it automatically runs the nREPL server on port 7000. We can connect to this REPL and inspect the running application as follows lein repl :connect 7000


Sorry, I don’t have the book so I don’t know what it’s asking you to do...


This is the connection error message: >onnecting to nREPL at ......:7000 ConnectException Connection refused: connect ( ( ( ( ( ( ( ( (<init> (<init> ( (nrepl.clj:184) Bye for now!>


@gdeer81, I think I need to connect to the repl before I can try running (mount/start #'guestbook.config/env)


Is your firewall blocking port 7000?


@mlev: Have you started the application? You will probably have to do something like lein run to get it started.


@shaun-mahood , when I run "lein run" I get: >"2016-12-07 17:25:40,528 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider read config from resource: "config.edn" read config from file: ".lein-env" 2016-12-07 17:25:41,077 [main] INFO guestbook.env - -=[guestbook started successfully using the development profile]=- 2016-12-07 17:25:41,171 [main] INFO luminus.http-server - starting HTTP server on port 3000 2016-12-07 17:25:41,233 [main] INFO org.xnio - XNIO version 3.3.6.Final 2016-12-07 17:25:41,437 [main] INFO org.projectodd.wunderboss.web.Web - Registered web context / 2016-12-07 17:25:41,437 [main] INFO luminus.repl-server - starting nREPL server on port 7000 2016-12-07 17:25:41,452 [main] INFO guestbook.core - #'guestbook.config/env started 2016-12-07 17:25:41,468 [main] INFO guestbook.core - #'guestbook.handler/init-app started 2016-12-07 17:25:41,468 [main] INFO guestbook.core - #'guestbook.core/http-server started 2016-12-07 17:25:41,468 [main] INFO guestbook.core - #'guestbook.core/repl-server started"


but it doesn't give me another command prompt line.


Yeah port 3000 is fine but your laptop is blocking port 7000


You could open up another terminal and connect to the running repl now 'lein repl connect localhost 3000'


if i give reducers/fold core/concat as a combiner, it would simply return things out of order right?


@gdeer81, thanks, that is good to know. I tried lein repl connect localhost 3000 but the result was unknown subcommand connect.


I did that with lein run running in the other command prompt window.


@mlev he meant lein repl :connect localhost:7000 I think


(based on what lein help repl shows)


You could also try lein repl :connect


(I know some people’s laptops have some network setup that prevents access via localhost but allows it via


@seancorfield , lein repl :connect worked perfectly. Thanks for all your help everyone!


Howdy everyone! I'm a totally new Clojure. I'm coming from a javascript (ember) and ruby (ruby on rails) background. Looking for an ambitious intro to language and ecosystem. Any suggestions for the best resource to start with to give me an ambitious trip through clojureland? Looking at: Joy of Clojure, Clojure for the Brave and True, and Living Clojure... didn't know if there was a canonical best first serious step?

Lone Ranger23:12:44

hey @ryanlabouve 🙂 I'm in the same proverbial boat


Any resource in particular stick out to you so far? 🙂


I'm reading Clojure for the brave and true and it is pretty beginner friendly

Lone Ranger23:12:36

2nded for Clojure for the Brave and True

Lone Ranger23:12:05

it does a pretty good breadth/depth, light on 'ecosystem' though


Are you both already emacs'ers?

Alex Miller (Clojure team)23:12:35

I’d start with either Brave and True or Living Clojure first

Alex Miller (Clojure team)23:12:01

and either Joy of Clojure or Clojure Applied second

Alex Miller (Clojure team)23:12:18

(I am a co-author of the latter, so bias noted :)


HA! Thanks for the disclosure 😛 No shame in being proud of your work though 😄

Alex Miller (Clojure team)23:12:25

I recommend all the other books too :)

Lone Ranger23:12:25

any suggestions on a light weight web framework for clojure apps?

Lone Ranger23:12:52

would love something a la Flask (Python)

Lone Ranger23:12:13

trying to get Clojure in on some microservices action 😄

Alex Miller (Clojure team)23:12:36

there is not one canonical answer in Clojure

Lone Ranger23:12:57

lol I don't need a canonical answer just any answer 😛

Alex Miller (Clojure team)23:12:14

many things are built on top of Ring (which is almost too light be a “framework”)

Lone Ranger23:12:26

I'm good with that

Alex Miller (Clojure team)23:12:27

Luminus is a set of libraries glued together in a template

Alex Miller (Clojure team)23:12:45

The Web Dev with Clojure book uses this

Alex Miller (Clojure team)23:12:10

there are alternatives to Ring as well like Pedestal or Yada


Living Clojure will teach you more fundamentals of the language, Clojure for the Brave and True will have you work on more application-style beginner work, based on my experience with them.


yeah, Luminus is probably the "safest" option for a newcomer, in terms of using tools that are well documented, and other people are actively maintaining


Web Dev with Clojure, make sure you get the 2nd edition, not the first, though.


If you find yourself buying multiple books, you may want to consider


You can get a monthly membership, and it gives you access to all of the latest books, which includes most of the latest Clojure dev books.


And don't forget @ericnormand has some excellent training resources

Lone Ranger23:12:09

just something that can serve up APIs is all I really need

Lone Ranger23:12:33

thank you all for the suggestions 🙂