Fork me on GitHub
#clojure
<
2017-10-16
>
qqq12:10:15

https://mxnet.incubator.apache.org/api/scala/index.html <-- this shows mxnet (Amazon's deep learning library) has an Scala API. I know how to call Java from Clojure. Is there a way to call Scala from Clojure ? If not, any suggestions on how to test this from Clojure ?

danm12:10:10

Is there a nice easy way to pretty-print XML without dropping down to Java calls? We're using clojure.data.xml to build an XML doc with xml/element calls, and it's all coming out on one line

qqq12:10:45

the answer to my own question appears to be "it's possible" https://github.com/grandbora/clojure-scala-cantrips#clojure-scala-cantrips

qqq13:10:58

I'm trying to call: https://github.com/apache/incubator-mxnet/blob/master/scala-package/core/src/main/scala/ml/dmlc/mxnet/NDArray.scala#L239 from clojure I have already done (:import [ml.dmlc.mxnet NDArray]) which works I can eval 'NDArray' ==> this works when I try to call "NDArray/ones" ==> it complains about not having the static method How do I get the boot repl to list for me all the static members of class NDArray ?

qqq13:10:18

self answer ==> (clojure.reflect/show NDArray)

blmstrm13:10:36

Hello! I have a part of my application where I sort values by inserting them in a map. The key creation process is automatic and generates keys from combinations of dates. This results in calls like this: (keyword "201701-201702"). What is best practices in this scenario? Should I prepend the date string with a character: (keyword "_201701-201702") or should I use the date string value as is as key? All look up in the map is done through (get m my-custom-key) where the same function that created the key is used to generate the key for lookup.

dpsutton14:10:07

what problem are you trying to solve?

dpsutton14:10:06

and "sort values by inserting them in a map" sounds like a weird thing to do as maps are not inherently sorted. although there is a sorted-map

qqq14:10:00

I'm doing a new ubuntu install. Will anything bad happen if I use openjdk-9 instead of openjdk-8 ?

the2bears14:10:14

@qqq install both?

the2bears14:10:28

setup alternatives to switch between which one you want.

qqq14:10:44

wait wait, does openjdk-9 == java 9?

qqq14:10:51

I thought there were some java 9 vs clojure conflicts

ghadi15:10:28

there are no java 9 conflicts with clojure -- it was leiningen

jumar17:10:42

Right, the last time I tried it it didn't work even when I used the runscript from the latest lein version. There was problem in bootclasspath (which could be solved by turning bootclasspath off) but other than that there was also some dynapath issue. After that I eventually gave up and reverted to java 8, since without leiningen my tooling is essentially useless. However, I'm able to run plain clojure repl with java 9:

clojure-repl-1.9: aliased to rlwrap java -cp /Users/jumar/.m2/repository/org/clojure/core.specs.alpha/0.1.24/core.specs.alpha-0.1.24.jar:/Users/jumar/.m2/repository/org/clojure/spec.alpha/0.1.123/spec.alpha-0.1.123.jar:/Users/jumar/.m2/repository/org/clojure/clojure/1.9.0-beta1/clojure-1.9.0-beta1.jar clojure.main

ghadi17:10:13

yeah if you use leiningen 2.8.0 when it's out, you'll be set 👌:skin-tone-4:

ghadi17:10:44

I just making sure that the blame/attribution is not clojure 🙂

Mudge15:10:24

I am having a problem with boot. After I call boot repl watch system I lose the ability to use the REPL. I made a short video of the problem here. Any help with this is much appreciated. Here is the short video: https://www.youtube.com/watch?v=TQsqkzzR-8g&amp;feature=youtu.be&amp;hd=1

blmstrm15:10:37

@dpsutton i shouldnt have used the word sorted, it is more like I use the map and it's keys as buckets and collect values in lists associated with the keys. My concern is more if it is nescessary to prepend the keyword with a character to avoid them starting with a number?

dpsutton15:10:23

you're turning strings into keywords and you're worried about the keywords being legal. why not just leave the keys to your map as the strings themselves and never worry about that at all?

dpsutton15:10:39

but it looks like :3 is against the spec although it works now. So I think your instinct to move away from this is correct but I dno't see a need to introduce a bigger workaround than using the original strings as the keys to your map.

blmstrm15:10:00

Exactly! I will do that! Thanks for taking your time answering me. Am I correct in assuming that the only functionality I will miss out on is that I can't use the strings as functions in for example threading macros?

dpsutton15:10:39

that's for sure a worry. but in your example earlier you were using (get map key) which should work just fine. If you need some more control over threading, you could swich to as-> which lets you introduce an alias for the threaded value so you can vary between first position and last

blmstrm15:10:56

I see! I'll look through my code and decide on what to do. Again, thank you.

noisesmith16:10:02

@blmstrm my strong preference is that if the identifier isn’t something I could ever use as a literal in my code (eg. your case where it’s generated at runtime so it will never be a code literal), I use strings instead of keywords, even when a keyword is passed in as an argument (and is meant to be a thing to look up and not generically a function to call) I still prefer the form where the map comes first (either calling the map, or explicitly calling get) - do remember that (map key) works, regardless of the type of key

blmstrm18:10:14

Thanks for reminding me about (map key) and thanks for answering. I think I will go with your approach.

eraserhd18:10:04

I strongly suspect that Go is a fad, and that once people have experience maintaining Go codebases, it will be suddenly uninteresting.

eraserhd18:10:24

I'm also surprised that Haskell isn't above Scala 😄

jstew18:10:58

I don't think it's a fad. Simply for the fact that google is pushing it. That being said, I have been hacking some go in my spare time and get frustrated that it's not as expressive as clojure.

tjtolton18:10:55

I wish I could get into Go, I love the idea. But languages that don't have functions as first class values... I don't know, I just don't think its worth it to me.

tjtolton18:10:15

I'd have to remember how to program.

eraserhd18:10:29

It could have staying power, the way Java has staying power. It could essentially replace 70% of greenfield C even. But I don't think it's going to stay on the developer "most loved" list.

jstew18:10:52

yes, it definitely feels like a step backward to me. Goroutines are nice, but it is still easy to have race conditions.

seancorfield18:10:45

A discussion for #other-languages perhaps?

tjtolton18:10:53

good move, thanks for keeping things clean!

Mudge19:10:26

I get the following error when I run "boot repl" on Windows 10 command line: [WARNING] No nREPL middleware descriptor in metadata of boot.repl$disable_exception_colors@4c415a68, see clojure.tools.middleware/set-descriptor! Any idea how to fix it?

seancorfield19:10:10

@nick319 I get that too but haven't dug into why. I suggest you ask in #boot

Mudge19:10:46

@seancorfield Are you running boot on Windows in the windows commandline?

Mudge19:10:57

I am asking because I wonder if the problem is windows specific or not

seancorfield19:10:35

It is not Windows-specific. I get it on all platforms with Boot, starting a REPL.

Mudge19:10:18

okay, good to know.

Mudge19:10:24

Hey, another question, I started a repl server with "boot repl -s"

Mudge19:10:53

I can reload clojure code in the reple server but my REPL clients don't see the code changes. Just asking, do you have any idea why?

seancorfield19:10:56

I'd take that question to the #boot channel too.