Fork me on GitHub
#clojure
<
2019-07-27
>
borkdude08:07:32

I noticed the QA forum has some CSS styling issues when it comes to code formatting

borkdude08:07:40

multiline code blocks are shown as a single line

carkh09:07:24

ah this might be a slight problem for the forum of a programming language =)

borkdude09:07:05

ClojureVerse, Reddit, Stackoverflow have no problems with this 😉

carkh09:07:30

i'm sure the solution won't be long to materialize

carkh09:07:50

though we'll kill the man by piling always more work on his back

borkdude11:07:34

^ this occurs only when using triple backticks. when indenting as a code block it works fine

carkh12:07:10

looking at your post, the syntax highlighter needs some work too... same problem on clojureverse

Theodor Thornhill12:07:49

Hello! I am building a ray tracer in Clojure at the moment, and I am running into some slow performance. I represent matrices as NxN native vectors. As far as I know, best case performance for calculating the determinant is O(n^3) (Using naive algorithm). I use get-in and assoc-in to access these matrices. When profiling, inverting matrices is the most expensive operation. I see three solutions now: 1: Using transient to gain some speed. I didn’t notice a huge improvement from this change 2: Running in parallel. Is there a way to use loop recur in parallel? Pmap does not seem to improve things much 3: Using library like Neanderthal I’d like to use as few dependencies as possible for learning reasons, so I’d like to avoid Neanderthal or core.matrix as for now. Right now the whole thing is immutable, so I expect some overhead here anyways:) Right now, 100x50 picture with six spheres with lighting and textures takes 29 seconds, and 2440x1220 took 5 hours. I’m not sure if this is acceptable or not :) I hope my question is clear, and thanks!

schmee13:07:58

@theodorthornhill I think using regular nested vectors to do compute-intensive matrix operations is a dead end no matter how you optimize it

schmee13:07:34

there is a reason all programs that do lots of matrix operations use highly specialized/optimized matrix libraries

schmee13:07:53

if you don’t want to use libraries, maybe you can switch from vectors to primitive Java arrays, that should give you much better performance than vectors (but still much worse than a library such as Neanderthal)

Theodor Thornhill13:07:20

@schmee that’s what I thought. Maybe I’ll just adopt Neanderthal later! Would be interesting to see the performance gain that would give me! Thanks for your answer!

👍 4
schmee14:07:28

is there a library that lets you use EQL to query regular maps?

schmidt7315:07:44

I don't know where else to ask, but I feel like some people here could point me in the right direction. What is the class of languages accepted by recursive descent parsers? Naive parsers without backtracking (or only weak backtracking) can clearly parse a superset of LL(1) grammars and they parse LL(1) grammars especially quickly as they won't need to backtrack. I believe that recursive descent with full backtracking (using continuations) can at least parse LL(k) grammars for any k while backtracking up to k steps for any wrong path. What other languages can these two algorithms parse? How does a recursive descent parser handle ambiguity? I imagine pretty well by backtracking and eventually finding a solution.

borkdude15:07:33

I would like to reply on this answer on the QA forum, but it seems it doesn't support comments like SO https://ask.clojure.org/index.php/8214/is-keys-destructuring-for-documentation-reasons-good-style?show=8217#a8217

Alex Miller (Clojure team)16:07:49

Why not just make another answer?

Alex Miller (Clojure team)16:07:02

It does actually support comments but I have them turned off

borkdude16:07:55

because an answer has votes and refers to the original question.

4
borkdude16:07:45

also you would have to @ a person to make clear it refers to someone else. it doesn't seem that forum was intented to be used that way as it doesn't let you reply on someone elses answer by quoting something

borkdude16:07:05

turning comments on would be useful to me

borkdude16:07:14

especially if answers are sorted on votes, making use of answers as comments gets confusing

Alex Miller (Clojure team)17:07:17

Answers are sorted on votes

Alex Miller (Clojure team)17:07:58

I’ll turn it on for answers

borkdude17:07:49

it seems triple-backquotes are interpreted as inline code. is that also configurable?

borkdude18:07:03

I mean, the indenting doesn't work there

Alex Miller (Clojure team)18:07:05

The editors are swappable and the markdown one is a little creaky. I will take a look at whether there is a better version.

Alex Miller (Clojure team)18:07:31

I might actually have an old one installed, not sure

aaelony19:07:56

My team at work recently adopted the Apache Zeppelin UI for data querying via sql and Spark shell. It seems based on Scala. Has anyone been in this situation been able to use scala interop from clojure or clojure directly from Zeppelin?

rovanion19:07:42

Does anyone have an opinion on websocket libraries for a server in clj and client in cljs? Sente or something else?

gklijs23:07:36

For cljs I like just javascript interop, it's simple enough and not really happy with the few I tried. For the clj part I like the one integrated in Nginx-clojure, or if using GraphQL lacinia(not really a websocket library)

nenadalm07:07:59

I use just WebSocket api in browsers (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). On last project, I needed to connect microcontrollers via websockets and Sente has some undocumented protocol which would have to be implemented in C . On server (ClojureScript) I used just some basic ws library: https://www.npmjs.com/package/ws. If all your clients/servers will be able to use Sente, then it is nice library I think (used that on one demo app).

pol20:07:59

Aleph on the server and Google Closure on the client is one option. Senate does more though eg. user sessions

dmaiocchi21:07:50

Aleph on server

dmaiocchi21:07:17

I was thinking that one can use aleph also in clojurescript as client

dmaiocchi21:07:49

Afaik it should be possible to use only aleph and manifolds Lib on client and server