Fork me on GitHub
#clojure
<
2018-10-26
>
funkrider02:10:27

hey @alexmiller, back in April you mentioned that there would be a powershell script for enabling the clj tooling on windows. I was wondering if that was available to test out some place?

Alex Miller (Clojure team)02:10:31

No, sorry. I haven’t had time to work on it since

emccue05:10:06

I am running into this issue

emccue05:10:31

Is there a way for me to customize from-java and to-java to handle this case?

emccue05:10:49

I have a ton of codegenned WSDL XML SOAP junk

emccue05:10:59

which has Boolean attributes

andy.fingerhut06:10:40

I have a patch you could apply locally to the source of that library that causes it to change Java Boolean constructed values to the ones that work more as expected in Clojure (and Java)

andy.fingerhut06:10:04

I don't know if it causes any new troubles that the original doesn't have.

andy.fingerhut06:10:38

I have attached it to the ticket. I can point you at instructions for applying the patch and locally installing the newer one on your system if you are interested in trying it out.

artur07:10:40

When I start 'lein repl' in project root, am I able to use the app's namespaces in repl?

andy.fingerhut07:10:15

Depending on the contents of the project.clj file, there might be a :main namespace already require'd, but for many projects no project namespaces are loaded by default when you do 'lein repl'

andy.fingerhut07:10:40

You should be able to run require commands at the REPL like (require '[my.app.namespace :as m])

artur07:10:33

Sorry, I actually have an issue with figwheel repl, wrong room

magra09:10:12

Hi, after an update of org.clojure/tools.reader 1.3.0 to 1.3.1 I get warnings: WARNING: Use of undeclared Var cljs.tools.reader/reader at line 947 resources/public/js/dev/cljs/tools/reader.cljs and more like this, all pointing to read+string in cljs.tools.reader. Do I report this and if so where?

bronsa10:10:13

I'll take a look

bronsa10:10:41

pushed a fix, will cut a 1.3.2 bugfix release now

💯 8
magra12:10:47

@bronsa wow! Thank you!

emccue14:10:24

@andy.fingerhut Thanks, I had the boolean multimethod in my code but "underiving" something i don't know how to do

emccue14:10:57

Theres no rush on this because its just in the POC stage right now

emccue14:10:24

so I can probably wait for your patch to be reviewed/accepted

emccue14:10:44

and then if I have to ill use a custom version

restenb15:10:16

so say I have a vector of strings in a certain order, i.e. ["first type" "second type" "third type" ...]

restenb15:10:08

and a sequence of maps with :typekeys like ({:type "third type"}{:type "first type"})

restenb15:10:34

how can I sort the map on the :type key with respect to the ordering of types seen in the vector?

schmee15:10:11

maps are unordered, so you can’t sort their contents

schmee15:10:25

can you give an example of what you want the output to look like?

restenb15:10:56

the sequence of maps sorted in the same order as the vector wrt. the type variable, i.e. ({:type "first type"}{:type "second type"}{:type "third type"} ...)

restenb15:10:51

the vector basically dictates the order the maps should appear in in the list

schmee15:10:08

you could do something like:

(def order (zipmap vec-of-strings (range)))
(sort-by #(get order (:type %)) vec-of-maps)

restenb15:10:39

yep, that worked

gfredericks18:10:17

are there printing libraries that can do a *print-length* but only apply it to sequential collections?

schmee18:10:39

I’ve been looking for this as well!

schmee18:10:56

I think you could roll your own with fipp, going to look into that one of these days 😉

👍 4
gfredericks19:10:57

nevermind, I realized preprocessing with clojure.walk is pretty easy

cpmcdaniel19:10:15

Is there a sense (even vague) of when Clojure 1.10 is going to land? Is it somewhat tied at the hip to Java 1.11?

cpmcdaniel19:10:56

oh, silly me. Java 1.11 is already a thing.

ghadi19:10:10

1.11 isn't a thing -- just 11

ghadi19:10:50

Clojure 1.10 my guess would be "before the Conj"

cpmcdaniel19:10:56

wow, so we skipped Java 2.0 - 10.0 😉

ghadi19:10:32

No relation between clojure version and java version. (Actually they skipped from Java 1.8 -> 9)

cpmcdaniel19:10:05

I bet you can guess what version I’ve been living in

andy.fingerhut19:10:57

According to semantic versioning, does 1.8 -> 9 jump mean that they intended to break lots of things? 🙂

😜 4
pauld19:10:51

What's the best way to debug a java constructor?

pauld19:10:38

I keep getting 'no matching ctor found'

ghadi19:10:02

What is the Java signature you're trying to hit?

pauld19:10:35

I can create Stop objects without issue.

pauld19:10:00

how can I narrow down which parameter is the problem?

pauld19:10:09

(LinearGradient. 0.0 0.0 0.0 1.0 true CycleMethod/NO_CYCLE (Stop. 0 (Color/web "0xAEBBCC")) (Stop. 1 (Color/web "0x6D84A3")) )

Jan K19:10:41

it's the varargs Stops, you have to put them in an array - or use the ctor that takes a list

👍 4
Jan K19:10:13

interop with vararg methods is a little tricky

ghadi19:10:21

Anytime you see Varargs in Java, it means you have to put them into an Array

ghadi19:10:46

this one would be (into-array Stop [... seq of stop instances])

pauld19:10:48

Ok, but it also should work with a vector?

ghadi20:10:02

Vector and Array are distinct types

ghadi20:10:07

Java cares

pauld20:10:13

oven if there is a signature that allows a List type?

ghadi20:10:25

Vector and List are compatible

pauld20:10:45

There are two constructors available according to javadoc

ghadi20:10:54

but you'll have to type hint it so that it can disambiguate

pauld20:10:00

one is var-args and one is List type

ghadi20:10:34

Do this: (set! *warn-on-reflection* true) Then evaluate the thing with a vector of stop instances

ghadi20:10:42

see if the compiler complains about reflection

pauld20:10:59

Thanks so much. Into array works.

pauld20:10:08

Going to try the type hint version.

ghadi20:10:13

serendipitously, I'm giving a talk at Clojure/conj this november about Java for Clojurists

👍 8
pauld20:10:41

type hint worked too! ^java.util.List[... stops]

pauld20:10:43

I forgot about type hinting for disambiguating constructors.

pauld20:10:27

especially in this tricky case where there is a var-args and version and a List version.

agigao20:10:40

Hi there, what's difference between clojure.xml and clojure.data.xml?

mikerod20:10:08

“.data”

😢 4
😆 4
mikerod21:10:30

sorry, just had to. However, I’d think clojure.data.xml is a bit more feature-loaded than the built-in clj ns. It is weird though that the built-in one exists and makes it confusing

👍 4
mikerod21:10:07

clojure.xml is a ns in clojure.core clojure.data.xml is a separate project, but it is managed via the main clj org in github still it seems

seancorfield22:10:22

The built-in one clojure.xml is pretty basic and hasn't evolved much over the years. The Contrib one clojure.data.xml has become pretty sophisticated over the years (including XML namespace support, I believe).

4
seancorfield22:10:23

If your needs are really simple in terms of XML parsing or emitting, the core version should be sufficient. If you need more than that, you'll need to add org.clojure/data.xml as a dependency to your project and use its more powerful API.

agigao07:10:40

Hi Sean, thanks for response! Well, the case is the following: Open xlsx -> map over 'XML' column -> get :tag "RNR" which is buried 2-3 level deep -> parse -> throw values to a corresponding columns.

agigao07:10:45

I'm stuck on a :tag selection, have been working in Python pandas for a while and trying things out in Clojure now out of the frustration and bitter taste the boilerplate brought in.

agigao07:10:07

(def data
  (->> (io/resource "single-multi.xlsx")
       (str)
       (xls/read-xls)))

agigao07:10:16

(->> (i/$ "DATADOCUMENTXML" data)
     (xml/parse-str))

agigao07:10:58

using incanter excel reader -> parse-str from data.xml

jvtrigueros21:10:24

Is dispatching a multimethod on count totally bonkers, or should I just use condp for the different logic? I have a set of vectors with two different sizes that I want to process with the same call.