This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-27
Channels
- # announcements (2)
- # beginners (85)
- # boot (4)
- # calva (4)
- # cider (14)
- # cljdoc (8)
- # cljs-dev (5)
- # cljsrn (10)
- # clojure (101)
- # clojure-europe (1)
- # clojure-italy (6)
- # clojure-nl (12)
- # clojure-spec (4)
- # clojure-uk (71)
- # clojurescript (119)
- # core-async (20)
- # cursive (1)
- # datascript (2)
- # duct (3)
- # emacs (19)
- # fulcro (150)
- # graphql (1)
- # hoplon (2)
- # instaparse (2)
- # jobs (1)
- # jobs-discuss (11)
- # joker (9)
- # luminus (6)
- # lumo (1)
- # off-topic (33)
- # onyx (1)
- # quil (1)
- # re-frame (23)
- # reagent (11)
- # robots (2)
- # rum (6)
- # sql (1)
- # test-check (10)
- # unrepl (1)
It seems straight to me how to fanout a channel into multiple ones, but I’m not using async, so I wonder if there’s a way to achieve the same thing for seq.
My real use case is that, I’m parsing a stream of bytes from a socket with a telnet-like protocol. I want to separate the telnet command bytes from the text bytes.
Currently what I’m doing is turning the bytes into a seq of packets, so something like
b b b b ... b -> {:type :telent :bytes [1 2 3 4]}, {:type :text :bytes [1 2 3 4]}, ...
Then I need to parse all the :text
to parse out some bytes for another protocol. I guess I can re-assemble all the :text
packets into a byte seq again, but I am afraid that there will be some performance issue.well I don’t see a clear way to do this with group-by
. To parse a byte and know which type it belongs to, I need to also check its previous and next bytes.
Using cljfx, is there a way to use openjfx Canvas? I can't find a sample on the site, and it isn't immediately intuitive as to how I would do it (or even make a plain OpenJFX element and add it to a cljfx node)
Oh, sorry I thought your example was showing the datastructure and you had them already parsed into maps
I do have them already into two maps, but this doesn’t work well if I want to parse the bytes of the third type.
It’s a telnet like protocol, so the sequences are identified by certain byte patterns. For example 255
is used as an escape character, so 255 249
means go ahead
, and 255 255
means 255
, kinda like escaped 255, and etc.
Has anyone experimented with grpc/protobuf and deps.edn? Is there a good library for compiling protobufs?
just generate java code from protobuf and use it with java interop thats how i do it with kafka
Does anyone know if Clojure works OK in WSL (https://docs.microsoft.com/en-us/windows/wsl/install-win10)
I'm running some compute intensive calculations on my Macbook like an idiot, when I have a monster of a gaming PC sitting in the next room twiddling its thumbs. I though maybe I could kick up a REPL on it and outsource the job.
been using clojure on windows since beta, making artifacts that would later run on solaris etc
the newish clj tool has trouble on windows yes, i have a workaround for that... let me find it
@U13RRNF2M For connecting, I'm getting timeouts on the REPL connections (so the REPL server isn't answering, I'm guessing), even though I've added rules for both ingoing and outgoing TCP connections on the correct port in Windows Firewall. Do you happen to know if I would need to do anything else to open the ports?
Yeah, I'm setting it up so that I can essentially use my laptop as a thin client to a much more powerful machine. But the laptop is still nicer to work on 🙂
I have a project that has a sever side component and a client side component. they have different dependencies, and I'm keeping them separate via lein profiles. For development convenience I want to merge the two, and I tried :repl [:client :server]
in my project.clj. However, while lein repl
does not include server-only or client-only deps, lein with-profile +repl repl
does. Am I misunderstanding hwo the repl
profile works? Do I add it somewhere else instead? Am I misunderstanding how lein repl
works?
I’d add them to :dev profile, which :repl
should also source
:dev
will also make the deps available to your tests.
https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#task-specific-profiles seems to confirm your expectation. > Some tasks automatically merge a profile if specified. Examples of these are the :test profile, when running the test task, and the :repl profile, when running the repl task.
that might be worth raising an issue. the code appears to try to get the repl profiles.
It’s a telnet like protocol, so the sequences are identified by certain byte patterns. For example 255
is used as an escape character, so 255 249
means go ahead
, and 255 255
means 255
, kinda like escaped 255, and etc.
My experience with protobuf (and grpc) was not great. I spent an hour on it, and I didn't get anywhere.
read the .proto
definitions with instaparse and do some analysis on them, turning each message
into a encoder/decoder
but I haven't made progress on it in a couple months, so maybe I should just push the code up
the output of the analysis phase should be plain data so that you could write it down and skip analysis if desired
Does anyone know why https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/gen-class does not mention that it is possible to attach Java annotations to methods and constructors? @alexmiller? (Neither does the Java Interop page, but that is not so surprising)
Probably because you can attach annotations to code without using gen-class
?
For example http://corfield.org/blog/2013/05/01/instrumenting-clojure-for-new-relic-monitoring/
I know that's not adding annotations to methods/constructors, just saying that you can do that in the general case outside of gen-class
.
Is the syntax much different for doing this within gen-class
?
(and, yeah, it would be nice if adding annotations was better documented somewhere...)
thx, I had no idea! And I'd correct >, it would be nice if adding annotations was better documented somewhere... to > it would be nice if adding annotations was documented somewhere... :)
Hah... yeah. I thought they were documented somewhere but I remember it being hard to find anything about it.
i will fix it :)
I'm having an issue in a large app where a top-level expression is causing a block on startup. Is there some flag I can pass to something to see what point clojure is at when it stops?
@phil start clojure with clojure.main and manually require your code entry point namespace with (require 'your.code :verbose)
Probably because you can attach annotations to code without using gen-class
?
if you write 'foo/bar
or
`foo/bar
or
(quote foo/bar)
how should that affect linting required but unused namespaces? In Clojure, you do not need to require namespace foo
in either case, although joker counts foo
as used in the case of the syntax-quote. Currently clj-kondo does the same for syntax-quote and quote
, although it probably shouldn’t in all these three cases.I think it's a good idea to lint
`foo/bar
as a fault if the foo
alias does not exist in the current ns.
Else:
`foo/bar
I would distinguish syntax-quote from plain quote though: only the former has the alias-expanding semantic, so I would only lint for the former
I have made two comments here: https://github.com/borkdude/clj-kondo/issues/210#issuecomment-496293314 I think that’s the same as what you’re saying here right?
so syntax-quote handles the symbol as “using” the namespace, but normal quote doesn’t
I agree if in:
> but these do not give the warning, which I believe is the incorrect behavior.
"the warning" means a warning other than is required but never used
, possibly a new one
Hi! Say I want the 4 fastest non-nils answers from 10 concurrent api calls, what is a good and fast way to do it?
(def ids `[1 2 3 4 5 6 7 8 9 10])
(defn ask
"may return nil"
[id]
(:body (http/GET {...}))
(defn take-4-first-non-nils [ids] ...)
You can play with pmap and a blocking queue. Each fn in the pmap pushes to the blocking queue. Then you grab 4 elements from the queue, which by definition will be the fastest ones Should be simpler than core.async code
@leontalbot you will need async/alt!
from #core-async
@souenzzo Thanks 🙂 Any example where we wait for first n results before returning them?
I’ve always seen example with the first result, but not more
thought it would start like so, but I don’t know actually (async/take 4 ...)