Fork me on GitHub
#clojure
<
2018-11-11
>
jwhitlark02:11:47

You can now send unix signals between containers in a Kubernetes pod. I wrote a short post about how to do that with Clojure on JDK11. https://blog.codeabout.info/2018/11/unix-signals-with-clojure-110-beta5.html

michaellindon19:11:12

I'm trying to do some repl based data visualization in clojure. I've tried gorilla repl, jutsu, and also oz. All of them seem to give me the following error message:

CompilerException java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(aleph/http/client_middleware.clj:420:7)

michaellindon19:11:18

is there any way i can get around this?

noisesmith19:11:28

what jvm version are you using?

michaellindon19:11:28

java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

noisesmith19:11:57

if you use java 8 instead that error should go away

noisesmith19:11:41

there's various libraries in the Clojure ecosystem that are not ready for Java's module stuff

schmee19:11:03

you can also add an explicit dependency on javax.xml.bind if you want to use Java 11

michaellindon19:11:59

I added [javax.xml.bind/jaxb-api "2.3.0" and [http-kit "2.3.0"] and now it seems to work, not sure which one of them fixed it

schmee19:11:06

the first one 🙂

michaellindon19:11:14

nice! 🙂 thanks

michaellindon20:11:49

how can i force a lazy seq like (range 0 2 0.1) to be evaluated. The output is getting truncated when i try to plot this.

michaellindon20:11:20

ive tried (into [] (doall (range 0 1.6 0.01))) but its not working

schmee20:11:51

AFAIK range doesn’t take float values

schmee20:11:10

so you need to make them ints and divide them later

michaellindon20:11:16

that makes sense, thanks

michaellindon20:11:33

that wasn't quite it, see if i try (spit "test.txt" (into [] (doall (range 0 200)))) and look at the file, this is the file I get

[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...]

schmee20:11:55

try to wrap it in (binding [*print-length* nil] ...)

michaellindon20:11:33

that changes the output to

(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...)

schmee20:11:35

instead of into, try pr

mfikes20:11:50

range can work on non-integer values, by the way

schmee20:11:57

sorry, pr-str, not pr

michaellindon20:11:00

using pr the text file is empty

didibus20:11:44

You running it in Cider?

didibus20:11:09

It sets print-length to 100

didibus20:11:05

http://Try.to run it outside of Cider. I think it will work

michaellindon20:11:50

you're right, this works outside of cider

mfikes20:11:15

You have to (set! *print-length* nil)

schmee20:11:57

wow that is a large preview

mfikes20:11:01

(`binding` is insufficient if the collection is then returned to be printed in the REPL after the binding unwinds)

schmee20:11:20

ahh, good ’ol lazy seq + dynamic binding

mfikes20:11:05

Well, it isn't the fact that the seq is lazy, its that the scope of the binding is only during the time that the form is evaluated, not when it is later printed in the REPL

didibus21:11:06

I mean, it's the combination of the two really. One can imagine a more complex system which would allow the lazy sequence to close over the bindings automatically.

mfikes20:11:11

user=> (set! *print-length* 3)
3
user=> (binding [*print-length* 200] [1 2 3 4 5 6 7 8])
[1 2 3 ...]