Fork me on GitHub
#clojure
<
2018-04-14
>
the2bears00:04:33

I miss planet.clojure 😞

benzap00:04:26

Did it get taken down?

the2bears00:04:39

Registration expired it seems.

benzap05:04:58

Is the character | an alphanumeric character?

benzap05:04:13

I only ask, because it appears to be a valid character when constructing symbols in clojure

benzap05:04:59

the edn format doesn't list it as a valid symbol, would it be a bad idea to use it in symbols? https://github.com/edn-format/edn

benzap05:04:54

It works when I pass it through an EDN reader, I wonder if it's just a typo

benzap05:04:15

Also, libraries like https://github.com/tonsky/clojure.unicode shouldn't work then, no?

the2bears05:04:04

I'm not saying it doesn't work. But if it's undocumented things might change. How necessary is it to use that character? Not at all I suspect.

the2bears05:04:52

Your call, but seems it's mostly aesthetics to include it in your symbol.

the2bears05:04:17

But now that I think about it, it's unlikely to change so it shouldn't really matter.

benzap05:04:02

It's such a pretty symbol though

benzap05:04:58

like, look at this, does this not portray what I want so succinctly? () <-| 1 2 3 |

the2bears05:04:41

Maybe? 🙂 Adding 1, 2, and 3 to a list?

the2bears06:04:14

It does look nice, that is true.

val_waeselynck10:04:17

@benzap you should also consider that it's hard to google this sort of name, it's also not obvious how to pronounce it.

👍 4
Alex Miller (Clojure team)12:04:23

I would stay away from using it in a symbol. We have talked about using | as an escaping character in symbols in the future so you could for example have spaces in a symbol name

👍 4
benzap18:04:03

Thanks for the feedback, i'll have to rethink using this symbol

hlolli13:04:44

is it possible to specify environmental variables like PATH or LD_LIBRARY_PATH in leiningen or if possible, in the java runtime? I'm loading jna native library which works well witha java.library.path an jna.library.path, but I have a shared library that depends on another shared library, and for that it seems that I can only reply on LD_LIBRARY_PATH. Since the shared library will be provided as a resource, I would like if it would be possible to have to specified within the project.

lvh14:04:32

I have a :gen-class'd namespace -- is there a way during testing (with clojure.test) to get an instance of that ns and call that method? I'm guessing... maybe not, because :gen-class only matters when compiling?

ddellacosta17:04:07

I just dropped transit into a project and I’m getting an exception simply trying the most basic example from the README:

ddellacosta17:04:35

that’s when I try

ddellacosta17:04:03

;; Write data to a stream
(def out (ByteArrayOutputStream. 4096))
(def writer (transit/writer out :json))
(transit/write writer "foo")

ddellacosta17:04:26

has anyone seen this? I’m using the latest version, 0.8.307

ddellacosta17:04:44

tried it with both Clojure 1.8 and 1.9 just in case it was related

ddellacosta17:04:24

I started with :msgpack and got the same thing

Alex Miller (Clojure team)17:04:23

I know @dnolen made some changes to transit this week...

Alex Miller (Clojure team)17:04:02

Your Java version might be relevant too

👍 4
emccue18:04:35

@ddellacosta How did you get a stack trace that nice

ddellacosta19:04:22

maybe ’cause I’m using cider?

eskos07:04:15

I don't know if cider is using this specific library but https://github.com/AvisoNovate/pretty is used by eg. Timbre and eftest to prettify stacktraces to similar form

ddellacosta19:04:12

sorry had to step away. Thanks all, will take a look

ddellacosta19:04:16

well, an update to JDK 10 doesn’t help

ddellacosta19:04:36

added all this to an issue (https://github.com/cognitect/transit-clj/issues/41), will move down a version and see if that fixes thing

ajs20:04:53

I'm using the most recent previous version without issue too.

ddellacosta20:04:26

of transit-clj, @ajs ?

matan20:04:46

Does clojure arrays box each element and/or store the type of each element alongside the element? I have a huge map where the values are arrays of floats, and I seem to get ~8 times more memory utilization than the size of a float (4 bytes) implies

ajs20:04:47

Your stack trace wrt reify does seem tied directly to the change yesterday. Yes I'm using 0.8.303

theeternalpulse20:04:41

Hi, I'm in the process of trying to grok specter and don't understand this difference in the output of the select, and the function that handles the output from the transform. The select yields a vector of vectors, while the transform fn takes in the first and the last separately. Also when trying to call LAST again in the select path, it errors out with Don't know how to create ISeq from: java.lang.Long which tells me that it actually selected individual values already. It's a little confusing by the output.

(select [INDEXED-VALS (collect-one FIRST) LAST]
        [5 6 7 8])
;; => [[0 5] [1 6] [2 7] [3 8]]

(transform [INDEXED-VALS (collect-one FIRST) LAST]
           (fn [a b]
             (println a "\n" b "\n===")
             (* a b))
           [5 6 7 8])
;; actual output [0 6 14 24]
;; Println output
;; 0 
;; 5 
;; ===
;; 1 
;; 6 
;; ===
;; 2 
;; 7 
;; ===
;; 3 
;; 8 
;; ===

nathanmarz21:04:56

@theeternalpulse select puts everything you've navigated to in your path in a vector

nathanmarz21:04:17

LAST operates on whatever it's currently navigated to at that point and has nothing to do with anything else you've navigated to

nathanmarz21:04:24

so LAST must be used on a sequence

nathanmarz21:04:45

if you want to navigate to the last thing navigated to by another path, you can use subselect

nathanmarz21:04:40

(transform [(subselect ALL even?) LAST] inc [1 2 3 4 5])
;; => [1 2 3 5 5]

theeternalpulse21:04:30

so that's why I'm confused. In this case

(select [INDEXED-VALS (collect-one FIRST)]
        [5 6 7 8])
;; => [[0 [0 5]] [1 [1 6]] [2 [2 7]] [3 [3 8]]]
The LAST would get me the vector in that, so why would a subsequent LAST not work. Sorry if the meaning is in your answer already, I'm just having a hard time connecting the dots with the example

nathanmarz21:04:36

at the end of that path you're navigated to 4 different locations, [0 5], [1 6], [2 7], and [3 8]

nathanmarz21:04:51

LAST there will navigate you to 5, 6, 7, and 8

nathanmarz21:04:03

INDEXED-VALS is like ALL except navigates you to the index + the value

theeternalpulse21:04:39

(select [INDEXED-VALS (collect-one FIRST) LAST LAST]
        [5 6 7 8])

theeternalpulse21:04:43

this error's out

nathanmarz21:04:04

because you're calling LAST on a number

theeternalpulse21:04:45

I guess that may be my understanding gap, the (collect-one FIRST) does not factor into the subsequent selections it seems.

nathanmarz21:04:31

collected values have nothing to do with what you're navigated to

theeternalpulse21:04:35

ok, but it does factor into the transform function

nathanmarz21:04:35

they only affect what happens at the end

nathanmarz21:04:50

in transforms they become the initial arguments

theeternalpulse22:04:17

Ok great, thanks for the help, something just clicked 🙂. Hopefully nothing broke.

nathanmarz22:04:17

there's a #specter channel too btw

👍 8