This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-04
Channels
- # architecture (27)
- # bangalore-clj (4)
- # beginners (22)
- # boot (35)
- # cider (26)
- # cljs-dev (2)
- # cljsrn (3)
- # clojure (156)
- # clojure-austria (3)
- # clojure-dev (9)
- # clojure-italy (25)
- # clojure-nl (10)
- # clojure-poland (5)
- # clojure-sanfrancisco (1)
- # clojure-spec (6)
- # clojure-uk (64)
- # clojurescript (169)
- # core-async (13)
- # cursive (13)
- # datomic (63)
- # dirac (50)
- # duct (21)
- # editors (1)
- # emacs (6)
- # events (1)
- # fulcro (1)
- # java (22)
- # keechma (14)
- # leiningen (2)
- # luminus (4)
- # off-topic (23)
- # onyx (4)
- # parinfer (5)
- # pedestal (4)
- # re-frame (6)
- # reagent (4)
- # ring-swagger (7)
- # rum (4)
- # shadow-cljs (84)
- # specter (5)
- # sql (36)
- # tools-deps (76)
- # uncomplicate (3)
- # yada (4)
When I execute clojure code (require '[clojue.tools.nrepl :as repl])
. I got error:
FileNotFoundException Could not locate clojue/tools/nrepl__init.class or clojue/tools/nrepl.clj on classpath. clojure.lang.RT.load (RT.java:456)
How to fix this?@stardiviner Put an r
in clojue
to make clojure
...
Thanks. I missed that, sloppy me.
what is the idiomatic way to make a stateful value (database connection) accessible to all the namespaces without passing it down as function argument?
@veix.q5 I agree with @U064X3EF3, but some people prefer the approach taken by Mount: https://github.com/tolitius/mount. Again, I don't recommend that - one more function argument is an insignificant cost, and allows for reifying the environment and making environmental dependencies explicit.
yeah, I am not one of those people :)
if you have multiple environment states that you want to pass, you may also consider passing a map that contains them all and call it something like env
.
You can set this connection as def
in some namespace. And when you need it from another namespace just use :require [db.ns :refer [my-connection]
@veix.q5 I'd argue the idiomatic way is to pass it down as a function argument. Either as a single argument or as an entry in a map. Non-idiomatic would be storing it in a var for instance. Or you could use something like mount or DIME https://github.com/kumarshantanu/dime
You also might want to use something like component
or mount
for organization that kind of statefull components
I would like to return the first item matching a regex. Here is what I have so far:
(first (filter #(re-find #"something = (\d+)" mydata)))
;; "some matching thing without the items being grouped by regex match"
I guess I could use map instead, and then pass that to filter, or is there a more idiomatic way?
I've got zero experience with Java and have difficulties assessing a h2 database from a luminus project. When tried:
java org.h2.tools.Server -tcp -tcpPort 9091 -baseDir ~/prog/clojure/orio/orio_dev.db.mv.db
Error: Could not find or load main class org.h2.tools.Server
To start H2 as a server, I think you want java -jar path/to/h2.jar -various -options
But you should be able to have it run in memory, without needing to start an external server instance.
@seancorfield I'd like to assess it from a client in order to check what I have there and to test some queries
@lum Something to consider is starting your Luminus app from inside the REPL, and then also using the REPL to run queries etc.