Fork me on GitHub

@jswart: Thanks, that really helps!


I am doing an AWS lambda clojurescript function. I have some external .edn files I want to read and def as a map in my code. (slurp “ “) doesn’t seem to work in clojurescript — what is the normal protocol for such?


@fingertoe if those files are resolved at compile time you can do it via JVM clojure using a macro


@bwstearns hey thanks for reply. that's just a self contained example which captures the essence of what I'm trying to achieve. real code is not like that! 🙂


Hi, people! what's up with the odd issues with type conversions in clojure? If I write a function like this:

(defn ^long foo [] 6676046666777281638)
and then try to convert the result to double:
(double foo)
clojure doesn't like it, and spits out this:
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: clojure.core[email protected]
What's going on here? NOTE: it does not depend on the dimension of the number, - whether I write 65012734070871023874 or 5 I get the same result


and, the funny part comes when I try to convert it to long - it doesn't work either, spitting out the same error!


I don’t know this area very well, but

user=> (defn ^Long foo [] 6676046666777281638)
user=> (double (foo))


foo isn’t a number ,it’s a fn


@donaldball sorry, I meant (double (foo)) @st sadly, changing the "foo" function is not an option - it belongs to a library


by the way, after some fiddling, I found the answer:

(double ^Long (foo))
no idea why the author of the library used (defn ^long ...) instead of (defn ^Long ...) though.

Alex Miller (Clojure team)18:10:01

the first example is not correct use of a type hint - var meta are evaluated so the long will actually resolve to the clojure.core/long function which is the result of the error

Alex Miller (Clojure team)18:10:11

you can see that if you (:tag (meta #’foo))

Alex Miller (Clojure team)18:10:18

(defn foo ^long [] 6676046666777281638) is what you want

Alex Miller (Clojure team)18:10:50

in this case the type hint is handled by the defn macro, which will not evaluate it

Alex Miller (Clojure team)18:10:35

if you really want it on the var you can do (defn ^{:tag 'long} foo [] 1)

Alex Miller (Clojure team)18:10:42

hinting it as ^Long is probably not what you actually want - that’s the Long wrapper object and will not give you the primitive return type performance that you likely want