This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-17
Channels
- # architecture (14)
- # aws (4)
- # aws-lambda (2)
- # beginners (66)
- # cider (63)
- # clara (39)
- # cljsjs (4)
- # cljsrn (3)
- # clojure (111)
- # clojure-berlin (5)
- # clojure-italy (17)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-uk (93)
- # clojurescript (19)
- # core-async (60)
- # cursive (13)
- # datomic (22)
- # devcards (2)
- # dirac (4)
- # duct (44)
- # emacs (18)
- # fulcro (1)
- # graphql (10)
- # jobs (13)
- # jobs-discuss (27)
- # lumo (1)
- # mount (1)
- # off-topic (22)
- # om-next (1)
- # onyx (16)
- # philosophy (3)
- # planck (4)
- # precept (34)
- # re-frame (66)
- # reagent (6)
- # ring (2)
- # ring-swagger (1)
- # shadow-cljs (333)
- # specter (8)
- # tools-deps (4)
- # vim (15)
- # yada (1)
I'm trying to push my first lib to clojars and am having problems with lein deploy clojars
. When I get to the part where it wants me to enter my password for gpg, I paste it in (it's really long) and first of all, it displays it in plain text (not as asterisks) and when I hit enter, gpg doesn't seem to get the password. Does anyone know how to get around this?
if you are hitting the tty interface for gpg, things have already gone wrong
lein can't share stdio with another program outside the jvm, so to use gpg you need a graphical client, or ensure the key is currently unlocked in your cache
also, the gpg signature of the artifact is incomplete with clojars at best, and can be disabled or skipped safely
Oh, I'll just skip it then. Thanks for the advice @noisesmith!
Hey friends, can anyone shed some light about why the default implementation chosen for core.async
buffers
is Java LinkedList
and not, for example, ArrayDeque
?
how could I set the s3 to skip the MD5 check on the uploaded file, I am trying to upload an image to local fakes3, but I get SdkClientException Unable to verify integrity of data upload. Client calculated content hash (contentMD5: 9Uw72PrP2ixIz7jhExr9dg== in base 64) didn't match hash (etag: 85dbae523824f9d892cb09e0af48f124 in hex)
why would you want that? Seems like something is going wrong with your client?
Does anyone know a library for controlling the mouse and keyboard? To simulate key presses and clicks?
Yes, I’ve done a lot of work on it, just haven’t had the time to pull it over the line yet
Not a direct answer but relevant SO answer ? TIL, LinkedList is also implemented as a doubly linked list and hence accessing last element is O(1). Also it seems that ArrayDeque was introduced in Java 6 but I don't know if supporting Java 5 was an issue at the time core async was written. git blame doesn't show any rationale behind this. https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist
Till Clojure 1.6 (March 2014) JDK 5 was the minimum JDK version supported : https://dev.clojure.org/jira/browse/CLJ-1268 First commit to core.async was on May 2013. Just a wild guess Rich might have used it for JDK 5 compatibility. First core.async commit : https://github.com/clojure/core.async/commit/47b1d24c0291050a1188dbeee2fc9227f694eb3c
It’s been long enough that I don’t recall why. It’s possible it was jdk 5 compatibility but I don’t remember that being a concern.
@alexmiller ArrayDeque
should create a lot less GC pressure than a LinkedList
, specially in high load...
Feel free to submit a jira
Why is Comparator
implemented in clojure.lang.AFunction
and not in clojure.lang.AFn
? I was looking at AFn
and was quite confused (I didn't even know that AFunction
existed).
Relevant commit : https://github.com/clojure/clojure/commit/56431834457820979e55c066e995ffe961ca11b3#diff-dbe6378825c2e51b49c0e222f6b0a102 . Commit message says refactoring without any concrete reason.
AFn is an abstract base class for function implementations and so is pretty generic
AFunction is only used in one place and has a bunch more functionality, so it’s a much more narrow use case
that one place being cached protocol functions
@alexmiller really ? all closures subclass AFunction, not only protocol functions
ah right, sorry
point is still that AFn is a more generic base class
That thing I understand but I was surprised that Callable
and Runnable
are implemented in AFn
while Comparator
in AFunction
Callable and Runnable are extensions of the IFn interface and thus implemented in the base to provide as much of the base implementation as possible. Acting as a Comparator is not something that is a general part of the IFn contract and so is not in IFn or implemented in the base.
(defn unchunk
[s]
(when (seq s)
(lazy-seq
(cons (first s)
(unchunk (next s))))))
(defn foo []
(unchunk
(map #(do (println "i" %)
%)
(unchunk (range 1 51)))))
(first (foo)) ;; returns 1, prints i 1, i 2
Why do I see i 1, i 2 printed here?Hmm, this prints four of them…
(defn unchunk
[s]
(when (seq s)
(lazy-seq
(cons (first s)
(unchunk (next s))))))
(defn foo []
(map #(do (println "i" %)
%)
(unchunk (range 1 51))))
(first (mapcat vector (foo)))
I really see that as a defect not an enhancement. Most not totally lazy seqs are due to chunking (32). That one is due to arg count (4)
temporarily I’ll fix it by using the suggested patches:
(defn join
[s]
(lazy-seq
(when-let [s (seq s)]
(concat (first s) (join (rest s))))))
(defn mapcat*
"Patched mapcat, see CLJ-1218"
([f] (comp (map f) cat))
([f & colls]
(join
(apply map f colls))))
(defn foo []
(map #(do (println "i" %)
%)
(unchunk (range 1 51))))
(first (mapcat* (comp vector str) (foo))) ;; only prints 1, returns "1"
why is this important to you?
I’m writing a crawler and I want to have fine grained control about how many links get crawled.
if you need to precisely control when and how much of a lazy seq is realized, then you should not be using lazy seqs
instead you should be using reduce/transduce/loop-recur etc
do transducers offer fine grained control over how many elements of the intermediate steps get realized?
(first (sequence
(comp
(map #(do (println "i" %)
%))
(mapcat vector))
(range)))
Prints 0 .. 32@roklenarcic do you have some examples how to configure the client
I can use the more low level stuff, but if I do have fine grained control, I prefer the style of being able to use normal functions like take, first, etc.
eventually it all gets realized anyway, but for development I’d like to (take 2 ...)
just for inspection and if it doesn’t realize too many, this is better
expanding transducers get fully expanded on each step (mapcat is the prime example of this) - this is the difference in the transducer pull model vs seq push
I must be being stupid. I don't quite understand how you're recommending transducers be used here.
if you want external control of iteration, then you need loop/recur.
or a queue/chan/etc
something that lets you take the next “thing” and choose when/whether to “do” it
looking for a lightweight lib to transform some HTML (specifically replace relative links/image src) — hickory, enlive come to mind, anything else I should check out?
I've had great luck with enlive for that sort of thing
@martinklepsch I love Jsoup personally
Do you know of some places that have some Clojure code that would help me get started with this kind of thing?
@martinklepsch Could send you some code if you want.
Please do :)
@alexmiller core.async might be a great fit for this too, yes. thanks for the suggestions.
got a question about ring/jetty - I need to read the HttpInputOverHTTP
obj in the :body
, and then reset it so it can be read again by another middleware
ah, it's just an inputstream with a fancy name (at least, that's how the other mysterious middleware in my app uses it)
well InputStream is abstract, so any particular one is going to be "fancy" in some way
I have a dependency problem i am trying fix for hours. core async seems to conflict with some other library and i get the following in the stack-trace: WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/boo lean? WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/boolean? Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.tools.analyzer.utils/boolean?, compiling:(clojure/core/async.clj:469:6)
what versions are you using?
what else are you using?
are you using lein or something else?
lein deps :tree
shows what?
well I can’t help you without more information
my guess is that you are getting an incompatible version of tools.analyzer and that’s causing core.async to fail
if you’re on latest lein, you can lein deps :why org.clojure/tools.analyzer
which will give you the dep path to the tools.analyzer version being used in the deps tree
Does clojure participate in Google Summer of Code? Will it be possible to apply as a student for clojure at GSoC 2019?
This depends on a) whether someone sends in an application for Clojure and b) and then whether they accept us. All of those possibilities have occurred in the past.
At this point, I think Cognitect will probably not lead this but I have encouraged Clojurists Together to do a.
Sounds awesome. Thanks. The community/students come up with the proposals or do the developers behind the clojure do it?
Anyone can propose projects but there needs to be a mentor willing to do it with the student
I'm currently a GSoC 2018 student working on a Clojure project, there were 2 or 3 projects this year looking for Clojure developers
Ok @alexmiller here is lein deps
so you have tools.analyzer 0.6.9 at the top level and that’s what core.async includes as well
another thing to watch out for is some sneaky snake including an older one of these libs inside their own jar (which is bad and wrong :)
I think there is a lein plugin that you can use to find stuff like that