This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-15
Channels
- # aws-lambda (6)
- # beginners (8)
- # cider (12)
- # cljs-dev (12)
- # cljsrn (9)
- # clojars (2)
- # clojure (161)
- # clojure-berlin (9)
- # clojure-italy (10)
- # clojure-russia (18)
- # clojure-spec (20)
- # clojure-uk (18)
- # clojurescript (37)
- # cursive (13)
- # data-science (1)
- # datomic (23)
- # flambo (2)
- # hoplon (22)
- # immutant (11)
- # jobs (1)
- # klipse (11)
- # leiningen (5)
- # liberator (7)
- # luminus (5)
- # lumo (3)
- # off-topic (28)
- # om (8)
- # onyx (15)
- # parinfer (111)
- # pedestal (21)
- # re-frame (6)
- # reagent (38)
- # rum (4)
- # spacemacs (2)
- # specter (34)
- # unrepl (122)
- # untangled (3)
- # vim (1)
- # yada (8)
is (async/chan) the same as (async/chan 0) or (async/chan infty) ? I used to think infty; but I'm now starting to think it's 0.
(chan 0)
is not allowed, as there is an assertion that it must be a pos?
number?
@qqq
Hi, I am getting this error when tring to use cider-find-var
after connected to a remote server compiled using lein uberjar
:
user-error: 'cider-find-var' requires the nREPL op "info". Please, install (or update) cider-nrepl 0.15.0-SNAPSHOT and restart CIDER
I use lein
and tools.nrepl
to start a nrepl server:
(defn start-nrepl-server [port]
(log/info "Start nREPL server at port:" port)
(reset! g-nrepl-server (nreplsrv/start-server :port port)))
and in project.clj
‘s :plugin
field,
[cider/cider-nrepl "0.15.0-SNAPSHOT"]
and :dependencies
:
[org.clojure/tools.nrepl "0.2.12"]
wait, are you using lein on the remote server or an uberjar?
because an uberjar won't have your plugins in it
I get that (swap! atom f) can execute f multiple times. Question: suppose we have multiple swap!'s -- is there any guarantee on the order in which the corresponding functions are claled?
the retry happens if another change to the atom happens between start and end of call to f
so if the first to start, is first to finish, it doesn't retry
other than that I don't think we can generalize much?
@noisesmith So I would add cider-nrepl
into dependencies
and have another try. Thanks!
f1 starts f2 starts f3 starts f1 finishes f2 -- oh fuck, cancelled f3 -- oh fuck , cancedlled -- do we have a guarntee that f2 will start/finish before f3 ?
cancelled? they run to completion, then run again
and no, it's based on the order they finish the first time
okay, I meant: f1 starts f2 starts f3 starts f1 finishes f2 / f3: completes, colmpare+swap fails do we have a guarantee that f2 will restart+finish before f3 ?
if f2 takes longer than f3, it could retry more times
and finish last
okay, so if we have n running concurrently, it's: first to finish = finishes, updates atom second to finish = next to run
if the starts overlap, yeah
@cmal iirc the cider-nrepl github page has an example of adding it to an nrepl you start yourself - it's not automatic, you need to apply it's middleware to nrepl
Can anyone recommend readings on desgining systems with 'back pressure' ? I'm convinced core.async/back-pressure is right, ... but I clearly don't know how to correctly handle the backpressure.
clojure.core.async/put! has a limit of 1024 go blocks can be parked on one channel right?
@oli : what is the problem? running out of memory? stack overflow? wrong answer? infinite loop ?
i like the aesthetics of (cons var (function x)) and i'd like to find a way to preserve them
(defn swap-exactly-once! [my-atom my-func]
(locking my-atom
(swap! my-atom my-func)))
this ensures the function my-func is NOT called multiple times right?so I can then add something which implements the Atom interface, and now I have "one at a time swap!" atom
(disclaimer/apology, pasting from clojure irc) does anyone have any clues as to how i would maybe go about changing the behavior of the lein repl multline promt? it is not so hard to change the normal prompt in the :repl-options, but how to handle the multi-line case? right now if i type i get: (defn foo [] #_=> (println "this is foo")) but i want to edit what shows up where the "#_->" prompt currently is. (i want it just to be whitespace)
My macro-fu is weak 🙁. How do I turn this:
(eval `(potemkin/import-vars
[clojure.spec.alpha
~@(clojure.core/keys (clojure.core/ns-publics 'clojure.spec.alpha))]))
into a form that uses a gensym for clojure.spec.alpha
?
Something like:
(eval (let [ns (gensym)]
`(let [~ns clojure.spec.alpha]
(potemkin/import-vars
[~ns
~@(clojure.core/keys (clojure.core/ns-publics ???))]))))
Bit curious about the context though, how do you expect that to return a non-empty set of keys?
Using ns
directly in ~@()
fails. But this works:
(eval (let [ns 'clojure.spec.alpha]
`(potemkin/import-vars
[~ns
~@(clojure.core/keys (clojure.core/ns-publics ns))])))
it's because at the evaluation time of ~@()
variable ns
is bound to the value generated by gensym
So the problem here is the order of evaluation with regards to the two nested let
s; you can't unquote-splice the ns-publics call because you need it to be evaluated in the context of the quoted let
something like this should work better:
(let [ns (gensym)]
`(let [~ns clojure.spec.alpha]
(potemkin/import-vars
(apply vector ~ns (clojure.core/keys (clojure.core/ns-publics ~ns))))))
gaverhae: eval
ing this throws:
1. Caused by java.lang.ClassNotFoundException
clojure.spec.alpha
URLClassLoader.java: 381 java.net.URLClassLoader/findClass
DynamicClassLoader.java: 69 clojure.lang.DynamicClassLoader/findClass
ClassLoader.java: 424 java.lang.ClassLoader/loadClass
DynamicClassLoader.java: 77 clojure.lang.DynamicClassLoader/loadClass
ClassLoader.java: 357 java.lang.ClassLoader/loadClass
Class.java: -2 java.lang.Class/forName0
Class.java: 348 java.lang.Class/forName
RT.java: 2168 clojure.lang.RT/classForName
RT.java: 2177 clojure.lang.RT/classForName
Compiler.java: 7145 clojure.lang.Compiler/resolveIn
Compiler.java: 7108 clojure.lang.Compiler/resolve
...
The tricky thing here is that potemkin/import-vars
is a macro. We need to pass it [clojure.spec.alpha ...
, but can't let
-bind clojure.spec.alpha
directly.Depending on your context I guess this could be useful?
(defn import-all-vars
[ns-symb]
(eval `(potemkin/import-vars [~ns-symb ~@(clojure.core/keys (clojure.core/ns-publics ns-symb))])))
This seems to work and gets you back out of macro land, so let should work as expected
(defn import-all-vars
[ns-symb]
(eval `(potemkin/import-vars [~ns-symb ~@(clojure.core/keys (clojure.core/ns-publics ns-symb))])))
(eval (let [some-sym (gensym)]
`(let [~some-sym 'clojure.spec.alpha]
(import-all-vars ~some-sym))))
seems to do the trick for me, though I'm not sure I see the point of the lets anymoreThis way the call to (ns-publics G_00001)
is generated by the quasiquote rather than evaluated outside it and spliced in, if that makes sense?
nice, it's more in spirit with the original idea 🙂
Disclaimer: sorry if it’s not the right channel to ask Looking for something like Lightbend Activator for Clojure: set of skeleton apps engaging popular frameworks and components, showcasing pattern. Maybe just a curated set of links? Thanks!
@dartov https://www.clojure-toolbox.com/ is pretty great
thanks pesterhazy! there is “Project Templates” category in the clojure toolbox, I’m looking for more like those templates
yeah the ones listed are great
also check tenzing (for boot frontend dev) and https://github.com/bhauman/figwheel-template for lein frontend dev
but of course all depends on what you actually need
@dartov Luke VanderHart gave a talk comparing ReactJS libs for ClojureScript https://www.youtube.com/watch?v=oRmj3IUkRVk with a companion repo showing the same app in 3 frameworks https://github.com/levand/qttt
@dartov @stuartsierra note that that talk predates Rum, which is now my go-to framework (providing both Quiescent-style functional components and local state should the need arise)
hm, I should try rum; normally I’m a big fan of re-frame which seems to take a pretty different approach (re-frame definitely has opinions about where your state lives)
tomaas: See
and
Specifically, you’ll need to:
1. Create a file.
2. Open an output stream on the file (using
Those are not URLs, they’re the name of functions in the
namespace. Slack just interprets them as URLs for some reason
Something like
(require '[ :as io])
(with-open [in (your-input-stream)
out (io/output-stream "/path/to/file" )]
(io/copy in out))
Worth reading through: https://clojure.github.io/clojure/clojure.java.io-api.html
(note that this will create a file on disk, which you can then open as a file; I'm not aware of any more direct way to go from a stream to a java.io.File, but I'm definitely not claiming any expertise around java io)
The file is not created on disk when you create the File instance… instances of File can represent non-existing files. I believe the file isn’t created on disk until you create the output stream on the file.
No method in multimethod 'do-copy' for dispatch value: [java.io.ByteArrayOutputStream java.io.BufferedOutputStream]
copy
copies from an input stream to an output stream. Looks like you have two output streams there.
You can’t copy from an outputstream to an outputstream.
You could get the byte array from the source outputstream and write that to the destination outputstream.
Does anyone know of a good database fixtures library for Clojure?
Or database seeding library
@weavejester about a year ago, after looking at damn near everything that was out there, I opted to roll my own around test.check generators, since I had built those anyway
I'm not sure how much of it is really extractable to a general-purpose lib, but none of the existing options really fit the need of my project
No problem 🙂
I think I’ll write my own.
see, by using the intelligence of all of #clojurians and abusing the def of 'one word', we can make this happen 🙂
I don't mind - in var names, but I dislike them in module names as they become _ in file names
give-me-your-password-and-username-preferably-the-right-ones-the-first-time-because-that-would-be-much-easier
of if you really really hate -
in names: giveMeYourPasswordAndUsernamePreferablyTheRightOnesTheFirstTimeBecauseThatWouldBeMuchEasier
> I don’t mind - in var names, but I dislike them in module names as they become _ in file names In Java it is pretty shunned to put “_” in package names too
which is far more often spelled cerberus
in English, so it seems a bit obfuscated
err sorry, that's: https://en.wikipedia.org/wiki/Cerberus
Unless you speak ελληνικά, of course
@qqq ya. I was actually being a bit facetious but it does kind of work depending on how much you expect your system to grow
κέρβερος ? And god forbid you forget to change ς
to σ
if you add something to the end of the name?
( https://en.wikipedia.org/wiki/Greek_alphabet#cite_note-nicholas_finalsigma-16 ) in case you have no idea what I’m talking about
When spelled cerberus in English, I believe I always heard it pronounced with a “s” sound
there's @mobileink , getting #clojure #offtopic again 🙂
Does anyone know why the RegexReader code in EdnReader.java is commented out? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L53
@hiredman that hasn't stopped them in the past 🙂 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L352
It is incredibly difficult to ensure you don't end up with any regex literals in your EDN. And one #"
will choke clojure.edn/read-string
. 😞
third party libraries can (and do) inject them via their own print-method
s, for example
anyway, I'm just complaining now 🙂
In actual seriousness about the unicode in filename questions: https://github.com/echeran/clj-thamil/blob/master/src/clj_thamil/%E0%AE%AE%E0%AF%8A%E0%AE%B4%E0%AE%BF%E0%AE%AF%E0%AE%BF%E0%AE%AF%E0%AE%B2%E0%AF%8D.cljc yes, it’s completely reasonable in some situations
Best way to get my attention: combine diverse human languages with programming languages 😄
@U4ZL7F31N , this seems relevant to your interest
tanzoniteblack: years ago i dabbled in making an arabic programming language by hacking a scheme implementation. didn't get very far, but very gratified to see this example. Clojure rules!
@mobileink just checking, was this you? http://nas.sr/%D9%82%D9%84%D8%A8/
(also: https://github.com/nasser/--- github does not like unicode project names apparently? )
i got a good one for ya: the roots of algebraic thinking are to be found in the philological writings of the scholars who preceeded al-Khwarizmi. his language is very similar to the language of the grammarians, which makes sense because arabic morphology is very algebraic. izzat nutty or what?
I should check that stuff out sometime. Really, I just need to get around to learning Arabic, it’s been on my todo list for a while, but hasn’t happened yet. But it might happen before too long, because I’m finally tackling Chinese, which has been on my todo list for only slightly longer
@U236LQYB0 no, that's not me, but thanks for the link! this is me: http://www.sibawayhi.org. warning: old sucky website, doesn't really work on mobile. hope to update it someday, since i now have clojure tools.
shockingly, arabic is very easy, IF you have the right pedagogical materials. well, except fot the pronunciation, that took me years of hard work. dm me if you ever need help.
chinese, i wish. or any tonal language. i can't quite wrap my head around meaningful tones.
Not apps, but I’ve been having a lot of fun/success with https://glossika.com/ as a language learning course lately
actually that’s not completely true, I have been using skritter app to help with learning Chinese characters https://skritter.com/
Hey folks sorry for the newbie question, is there a list of open source Clojure projects somewhere in this slack? Or a channel for it?
@guy There’s https://www.clojure-toolbox.com/ if that’s what you mean.
@guy: There's also http://open-source.braveclojure.com/ if you're looking for something to contribute to