This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (38)
- # aleph (1)
- # bangalore-clj (3)
- # beginners (126)
- # boot (165)
- # boulder-clojurians (5)
- # cider (42)
- # cljsrn (11)
- # clojure (203)
- # clojure-greece (6)
- # clojure-hk (1)
- # clojure-italy (11)
- # clojure-new-zealand (1)
- # clojure-nl (1)
- # clojure-russia (112)
- # clojure-spec (86)
- # clojure-uk (176)
- # clojurescript (38)
- # code-reviews (2)
- # core-async (2)
- # cryogen (2)
- # cursive (16)
- # datascript (2)
- # datomic (80)
- # events (2)
- # garden (28)
- # hoplon (115)
- # jobs (1)
- # jobs-discuss (7)
- # klipse (50)
- # lein-figwheel (15)
- # liberator (17)
- # luminus (6)
- # off-topic (8)
- # om (31)
- # onyx (26)
- # parinfer (4)
- # planck (35)
- # protorepl (26)
- # quil (2)
- # re-frame (50)
- # reagent (21)
- # ring (5)
- # rum (2)
- # schema (1)
- # untangled (29)
- # vim (10)
- # yada (40)
Understanding destructuring and all of its many forms is an essential thing to get familiar with from the very beginning
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.
@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
@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 🙂
just imagine rewriting destructuring as a let, and that’s pretty much what it does
My gf is still harassing me about writing a library like that except it would be Clojure in long English
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:
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?
IllegalArgumentException db-spec [email protected] is missing a required parameter clojure.java.jdbc/get-connection (jdbc.clj:309)
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?
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.
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.
Which “that” do you mean @alexmiller ? https://clojurians.slack.com/archives/beginners/p1481140927000772
There are many answers and many kinds of apps and we should always be open to something new too
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
@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
version.properties 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
version.properties as needed (we usually put a dummy
”x.y.z” version placeholder in the
deps.edn file to signify that it is always overridden).
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.
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”.
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 http://seancorfield.github.io/blog/archives/
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
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.
If you did
lein repl, it just started up a new REPL, it didn’t connect to your running app (just FYI).
ClassCastException indicates you are trying to call something that is not a function (instead it’s a
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
@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
This is the connection error message: >onnecting to nREPL at ......:7000 ConnectException Connection refused: connect java.net.DualStackPlainSocketImpl.connect0 (DualStackPlainSocketImpl.java:-2) java.net.DualStackPlainSocketImpl.socketConnect (DualStackPlainSocketImpl.java:79) java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:350) java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:206) java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:188) java.net.PlainSocketImpl.connect (PlainSocketImpl.java:172) java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392) java.net.Socket.connect (Socket.java:589) java.net.Socket.connect (Socket.java:538) java.net.Socket.<init> (Socket.java:434) java.net.Socket.<init> (Socket.java:211) clojure.tools.nrepl/connect (nrepl.clj:184) Bye for now!>
@gdeer81, I think I need to connect to the repl before I can try running
@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"
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 know some people’s laptops have some network setup that prevents access via
localhost but allows it via
lein repl :connect 127.0.0.1:7000 worked perfectly. Thanks for all your help everyone!
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
If you find yourself buying multiple books, you may want to consider https://www.safaribooksonline.com/pricing/
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.