Fork me on GitHub
#clojure
<
2018-11-29
>
alexl06:11:22

Has anyone dealt with the Microsoft Graph API, just looking for some pointers on getting started with it. Fairly new to Clojure.

emccue07:11:18

I haven't but I can probably help you with using the Java library

emccue07:11:38

quick google came up with this

kulminaator07:11:14

For the curious, tried the new a1 (arm64) gen machines on aws with ubuntu linux, java and clojure work nicely :)

emccue07:11:21

(from the readme)

emccue07:11:41

making the same call from clojure would look like this

emccue07:11:44

and the next call on there for getting the users drive

emccue07:11:28

the equivalent clojure would be

emccue07:11:21

(those snippets cover quite a few clojure idioms and features, so feel free to ask for more info)

Saikyun09:11:06

have anyone here used clojure with opengl or similar? I'm having a hard time finding information about how to go on about it

sulami12:11:10

http://quil.info is a good start if you just want something drawn

Saikyun08:11:33

thanks a lot @U9W4GLX4L, looks really neat. I'll dig into it. I managed to get lwjgl working as well, so might use that. but quil looks really cool as well

Eyal14:11:46

Hi guys, I'm using the AWS Java SDK V2 and am getting IllegalArgumentException Can't call public method of non-public class: public final java.lang.String software.amazon.awssdk.core.BytesWrapper.asUtf8String() throws java.io.UncheckedIOException clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88) when trying to access the public functions of a non-public super-class of an object. specifically: I'm using the getObject method on an S3AsyncClient object with the ByteArrayAsyncResponseTransformer to get on object as a byte array. the returned value is an object from the public class ResponseBytes that extends the BytesWrapper abstract (non-public) class. But because of the reflection implementation of Clojure, I'm unable to access any of the public methods of BytesWrapper (such as asUtf8String). Do you guys know of anyway to access these super methods?

mccraigmccraig14:11:52

@eyal.shalev i've hit this problem before - iirc you have two options - [1] is to write some java which exposes an interface you can call from clojure and [2] is hacky but doesn't require any java and is to override the access modifiers (assuming your SecurityManager permits it) https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/AccessibleObject.html

Alex Miller (Clojure team)14:11:31

What version of Java and Clojure?

Eyal14:11:58

Java version 1.8 Clojure version 1.9.0

Alex Miller (Clojure team)15:11:28

Did you try type hinting to the public class to remove reflection?

Alex Miller (Clojure team)15:11:33

Not sure if there is a bug here or not, would be great to have a ticket with more details

mccraigmccraig15:11:21

although looking at the problem i hit it was the other way around from @eyal.shalev’s problem (package private impl inheriting from public interface), so may be a similar looking but different issue: https://github.com/nats-io/java-nats/pull/35

Radek15:11:05

Hey guys, why isn't javax.websocket extension available to me? I'm trying to import it but without any success.

adam16:11:37

I am trying to get a Clojure/Leiningen project going on a Windows 10 machine (was using Mac). I installed the Linux Subsystyem (Ubuntu) and I am connecting remotely to the REPL that is running inside the subsystem. It seems a little slower but it works. What doesn't work though is when I edit a file. I generated the project using Compojure template so it has autoreloading enabled. When I edit a file I get: java.io.FileNotFoundException: Could not locate ring/mock/request__init.class or ring/mock/request.clj on classpath., compiling:(myproject/handler_test.clj:1:1). The project auto reloads reliably on Mac - Any idea what is wrong and how to fix it?

adam17:11:24

I found the solution here https://github.com/technomancy/leiningen/issues/1666#issuecomment-131562170 ... still not sure why it was working fine on Mac though.

chadhs18:11:24

have you guys been seeing this error lately at all?

Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec:
In: [0] val: nameofproject.core/-dev-main fails spec: :clojure.core.specs.alpha/ns-form at: [:args :name] predicate: simple-symbol?

chadhs18:11:07

i commonly use a -main and -dev-main like this

(defn -main
  ([]     (-main 8000))
  ([port] (jetty/run-jetty app
                           {:port (Integer. port)})))

(defn -dev-main
  ([]     (-dev-main 8000))
  ([port] (jetty/run-jetty (wrap-reload #'app)
                           {:port (Integer. port)})))

noisesmith18:11:23

but that error is about your ns form

chadhs18:11:24

if i merely comment out this line in my :dev profile it doesn’t complain

:main nameofproject.core/-dev-main

noisesmith18:11:37

wait, that's in your ns form?

chadhs18:11:30

ns form in core.clj is just this

(ns nameofproject.core
  (:require [compojure.core                 :refer :all]
            [compojure.route                :as    route]
            [ring.adapter.jetty             :as    jetty]
            [ring.middleware.defaults       :refer :all]
            [ring.middleware.webjars        :refer [wrap-webjars]]
            [ring.middleware.reload         :refer [wrap-reload]]
            [ring.middleware.session.cookie :refer [cookie-store]])
  (:gen-class))

noisesmith18:11:08

OK - my guess is that leiningen uses the arg to :main to construct a call to clojure.core/ns

chadhs18:11:40

just confused on how i set a different main function for the dev profile

chadhs18:11:44

it’s always worked in the past

noisesmith18:11:08

the :main option in project.clj is for defining a main namespace, the name -main has special meaning to clojure

chadhs18:11:53

curious when this changed.

noisesmith18:11:12

I suspect that in the past, when clojure was less picky about validating the ns form, it just silently did a GIGO when invoked

chadhs18:11:13

a number of tutorials have used this pattern for years

noisesmith18:11:15

now it complains

noisesmith18:11:24

yes, the tutorials are wrong as far as I know

chadhs18:11:47

well shoot. time to find a new pattern for including wrap-reload in dev mode

chadhs18:11:10

that’s a huge problem. going to ask in #beginners ; as like every article suggests this for ring/compojure apps

chadhs18:11:52

for now i’ll just omit it and rely on lein ring server for local reloading dev

noisesmith18:11:12

hmm... talking with technomancy (he avoids slack), and he thinks that is supposed to be supported - can you tell if it's lein calling ns or if some plugin is doing it?

noisesmith18:11:11

one more thought - if this is happening when starting a repl, what happens if you also define :init-ns - because one source of this error would be if lein tries to use the value of :main to decide what ns to put you in at startup

chadhs18:11:00

@U051SS2EU thanks! would i set init-ns to project.core like im doing for :main?

noisesmith18:11:32

right, but just the ns, not the function name - technomancy verified if he deleted the :init-ns option he can replicate this error

chadhs18:11:49

trying now

noisesmith18:11:45

forwarding this:

technomancy | justin_smith: fixed in 7525142
- so yeah you found a lein bug

noisesmith18:11:56

and there's a commit with a fix

chadhs18:11:19

i feel special now lol

chadhs18:11:41

i really appreciate the help on this. please pass my thanks along to technomancy as well

chadhs18:11:18

going to comment this out in the mean time and work around it

Curtis Bowman19:11:34

Just watched Stu's talk on REBL and would love to spend the afternoon messing around with it. Does anyone know when/where the early access will be made available?

Curtis Bowman19:11:15

@alexmiller Awesome, I wasn't sure if it had already been published and I just wasn't looking in the right place. I've already extended the datafy and nav protocols to some stuff in a side project I'm working on, and I'm curious to see how it works with the REBL browser (or if I've even do it correctly).

jaide19:11:27

That is exactly what I’ve been wanting!

Jimmy Miller20:11:12

Hey Alex, checking out the license it says. > You may not use REBL for commercial use. Does this mean I can only use this in my spare time, but not for clojure I write in my day job?

jaide20:11:22

@U5K8NTHEZ There’s a bit of dialogue on that in the #off-topic channel https://clojurians.slack.com/archives/C03RZGPG3/p1543520328982200

csm20:11:31

+1 for clarification on the license. I exclusively develop clojure for a commercial product, so I’m not even downloading it unless I’m able to use it

darwin21:11:26

I wanted REBL since 2016 at least 🙂 https://github.com/binaryage/cljs-devtools/issues/11 Now let’s wait when someone comes with nREBL 😛

darwin21:11:55

Anyways, super-excited about this development!

adam20:11:42

Is this a Mac-only app?

orestis20:11:00

Says JavaFX so probably cross-platform?

abdullahibra21:11:19

seems the function args is evaluated before pass to the function

abdullahibra21:11:44

is there a way to fix this or should i think in another approach ?

noisesmith21:11:28

the macro args are evaluated after they are returned by the macro

abdullahibra21:11:29

but at compile time

abdullahibra21:11:34

(defn foo [l] (type-0 l)) CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

noisesmith21:11:34

the macro args are not evaluated before the macro runs, so if your macro needs a collection, it needs a literal collection as an input

abdullahibra21:11:17

you mean ["hello" "world"] ?

rutledgepaulv21:11:03

why are you macroing? just so you don’t have to quote your symbols ?

noisesmith21:11:19

@abdullahibra or [hello world] like in your example

noisesmith21:11:51

macros are for transforming an input form into a new form to be compiled

noisesmith21:11:03

they can't operate on data that isn't known when compiling

abdullahibra21:11:21

Good, thank you 🙂

noisesmith21:11:27

said something wrong at first - now I see why you need quoting there

noisesmith22:11:41

@abdullahibra oh - double correction - not only does it work without ~@ - it works without using quoting at all

ins)user=> (defmacro type-0 [l] (mapv str l))
#'user/type-0
(ins)user=> (type-0 [a b c])
["a" "b" "c"]

noisesmith22:11:10

but it's good to use ` so that mapv and str are fully qualified in the result

bronsa22:11:24

that's doing the mapv str at compile time, qualifying doesn't mean anything

bronsa22:11:41

they're resolved by the runtime, after macroexpansion the mapv expression doesn't exist anymore

noisesmith22:11:53

oh - fair, so there's no hygeine issue

bronsa22:11:53

user=> (defmacro type-0 [l] (mapv str l))
#'user/type-0
user=> (defmacro type-0' [l] `(mapv str '(~@l)))
#'user/type-0'
user=> (macroexpand '(type-0 [a b]))
["a" "b"]
user=> (macroexpand '(type-0' [a b]))
(clojure.core/mapv clojure.core/str (quote (a b)))

pmooser22:11:49

REBL looks cool, but I'm curious if it will continue to be closed-source. I realize no one here may know or be able to answer.

dpsutton22:11:08

i would imagine. i'm totally ok with using a quality closed source product. basically every webapp (including this one) is like that

rickmoynihan23:11:48

Does anyone know how to run REBL inside cider/nrepl? nrepl is mentioned in the README

lilactown23:11:17

did we get an answer on the "can I use it while while at my day job as long as I don't embed REBL" question?

👍 4
dpsutton23:11:28

issue open on GH, mentioned in #off-topic, it's on HN and reddit. no clarification

🆗 4
Alex Miller (Clojure team)23:11:14

People are busy with the conf, so give them some time. My personal belief is that the intention is for anyone to be able to use it

👍 24
Alex Miller (Clojure team)23:11:28

But that is not an official answer

dpsutton23:11:23

understood. it is still release candidate anyways 🙂