This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-28
Channels
- # aleph (3)
- # beginners (10)
- # boot (135)
- # clara (2)
- # cljsjs (2)
- # cljsrn (1)
- # clojure (68)
- # clojure-austin (4)
- # clojure-france (2)
- # clojure-japan (1)
- # clojure-spec (30)
- # clojure-uk (11)
- # clojurescript (48)
- # component (65)
- # cursive (5)
- # datomic (40)
- # dirac (5)
- # emacs (3)
- # events (16)
- # funcool (2)
- # klipse (46)
- # lein-figwheel (2)
- # luminus (8)
- # off-topic (4)
- # om (7)
- # other-languages (4)
- # parinfer (21)
- # re-frame (15)
- # reagent (30)
- # ring (1)
- # ring-swagger (9)
- # rum (3)
- # specter (7)
- # test-check (8)
- # testing (5)
- # vim (21)
- # yada (4)
Is it possible to write a schema that validates more than one field at a time together?
anyone know of a x-www-form-urlencoded parser or x-www-form-urlencoded to edn converter?
idiomancy: I'm sure the ring libraries use one somehow
I often feel like a macro
(in-parallel
(external-api-call)
(external-api-call)
(external-api-call))
@bfabry you might want to use go
process to put and retrieve the result
@baptiste-from-paris I mean, I could make each of those future calls a go block but that's doesn't really gain me anything as far as I can tell
i really depends whether you need to deref
it or not
base on you use case, it depends
why do you need to block everything
because the next task I want to execute depends on all of those tasks having completed
hey, is this the right channel to ask about namespace tools and cljc?
Say I have a vecor of maps, is there an easy way to run through each map and get the values of a specific key?
@urbanslug (mapv :a [{:a :c} {:a :b} {:a :z}])
Just wondering, is there anything in or for Leiningen, that can re-run your project whenever you save any of its sources? (like figwheel for clojurescript, nodemon for node.js, etc...)
I have this issue where loading my dev/user.clj
is not enough to properly load the files it requires, I have to go and manually load some of the transitive dependencies, and it only errors at runtime...
I remember running into that in the past and never really figured out what the problem was, but my current project is plagued with those problems
@matan Some people use an editor hook, (e.g. for vim autocmd BufWrite *.clj Eval (reset)
) but most people just map it to a short keybinding (I have a reset bound to ,rs
for example)
@matan You probably need a state management in order to use these, I suggest looking into: - http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded - https://github.com/stuartsierra/component - https://github.com/tolitius/mount - https://github.com/weavejester/reloaded.repl to help understand this pattern.
@jfntn That kinda sounds like the namespaces aren't being require
d, and are perhaps using fully-qualified namespaces in order to hack it into working?
@matan: depending on your application, there tend to be some tools around this too; for example for Ring apps there's the (wrap-reload)
function: https://ring-clojure.github.io/ring/ring.middleware.reload.html
@timgilbert wrap-reload doesn't work with stateful things particularly well.
Well, I agree in principle but for less stateful things it's more handy than needing to restart your web server every time you make a code change...
@matan you can see an example app with restartable web server here: https://github.com/tolitius/stater/tree/master/smsio
to restart the server (only that component) for example, you'd do:
(mount/stop #'app.www/web-server)
(mount/start #'app.www/web-server)
Thanks a lot. I was actually, admittedly, looking for something easy rather than simple 🙂 as in the Scala world this was built into the equivalent of leiningen. I think I'll avoid the need for code changes and skip on this dev flow feature for now...
@matan It's not common to restart the entire server in Clojure, it's considered too slow of a process.
If you're completely stateless clojure.tools.namespace.repl/refresh-all
should work if you depend on tools.namespace
I don't suppose there's anyone else here crazy enough to try to interoperate jython and clojure?
running into a problem with jython not being able to figure out MRO for clojure.lang.PersistentVector's remove(), and was hoping to find someone else who has encountered the issue
i run jython and clojure together
haven’t encountered that issue though
can you describe the issue more?
it's actually pretty easy to duplicate. if you take a recent Jython standalone jar (grabbing 2.7.0 from their homepage), add clojure-1.8.0.jar to the classpath and run
java -cp jython-standalone-2.7.0.jar:clojure-1.8.0/clojure-1.8.0.jar org.python.util.jython -c "import clojure.lang.PersistentVector"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Supertypes that share a modified attribute have an MRO conflict[attribute=remove, supertypes=[<type 'clojure.lang.ASeq'>, <type 'java.util.List'>], type=APersistentVector$RSeq]
yeah we have a shim that converts all our clojure-y stuff to jython-y stuff
i actually have it in a gist
been meaning to put it in its own repo and ‘publish’ it but haven’t gotten around to it
i’m now vaguely remembering those MRO errors and i don’t think we ever came up with a different solution besides converting to jython objects first
something to do with multiple inheritance
Huh, this is surprising... I can't use a namespaced keyword which is the same as a function name? In other words:
(ns foo)
(defn bar [x y]
{::bar (+ x y), ::other-stuff [...]})
(ns baz
(:require [foo :as f]))
(defn get-bar []
(::f/bar (f/bar 1 2)))
The get-bar
function will complain that #'foo/bar
is not public, even though the invocation of ::f/bar
would seem to indicate that I'm referring to the namespaced keyword, not the function.In practice, I can avoid this kind of overlap, but it's surprising that it's an issue.
How can I refer
require
d vars/fns as
something else? IE (require [core.x :refer [map :as x-map, reduce :as x-reduce]])
to avoid name collisions?
@josh.freckleton (:require [core.x :refer :all :rename {map x-map, reduce x-reduce}])
which is HIGHLY discouraged.
@arrdem thanks!