This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-05
Channels
- # announcements (1)
- # beginners (72)
- # boot (4)
- # calva (35)
- # cider (8)
- # clara (13)
- # cljdoc (31)
- # cljs-dev (34)
- # clojure (64)
- # clojure-europe (1)
- # clojure-finland (3)
- # clojure-italy (23)
- # clojure-losangeles (3)
- # clojure-nl (35)
- # clojure-uk (19)
- # clojurescript (26)
- # cursive (19)
- # datomic (12)
- # duct (5)
- # editors (7)
- # emacs (25)
- # fulcro (40)
- # funcool (5)
- # jobs (2)
- # leiningen (3)
- # luminus (2)
- # lumo (3)
- # off-topic (19)
- # pathom (3)
- # planck (2)
- # reagent (6)
- # remote-jobs (4)
- # rum (1)
- # shadow-cljs (23)
- # spacemacs (6)
- # tools-deps (12)
Trying to use lein kibit
with a dependency that uses .cljc
files, getting No namespace: foo.bar.baz found
as an error. Does anyone know how to resolve this?
Turns out, this is because I was using #foo.bar.baz{:a 1}
, and I don’t think the reader knows how to handle it.
I am tracing it back, kibit
uses org.clojure/tools.reader
, and [clojure.tools.reader$read_namespaced_map invokeStatic "reader.clj" 760]
is where it is crashing, but I’m not very familiar with this reader lib.
I am tracing it back, kibit
uses org.clojure/tools.reader
, and [clojure.tools.reader$read_namespaced_map invokeStatic "reader.clj" 760]
is where it is crashing, but I’m not very familiar with this reader lib, and it is not clear to me that cljc
support is provided…
@lilactown https://mail.openjdk.java.net/pipermail/openjfx-dev/2018-September/022500.html
javapackager distro for JDK 11
Interesting! And it looks like they are making good progress on the one they are going to release officially. Until then I am getting by fine using my JDK 8 javapackager pointed at a current OpenJDK distro to build my Mac app, and one of my kind Windows users has set up an sftp server that uses a third-party tool to create a nice MSI installer.
I've just run jcmd <pid>
in a docker container running our Clojure application on OpenJDK 11 (Ubuntu).
In the "Internal exceptions" section I've found a few instances of this exception:
Event: 4103.838 Thread 0x00007f800400c800 Exception <a 'java/lang/ClassCastException'{0x00000000c78ba0b0}: class clojure.lang.Keyword cannot be cast to class java.lang.CharSequence (clojure.lang.Keyword is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader
I couldn't find any info about this one (or what exactly the "Internal exceptions" mean in this context) so I'm wondering if it's something I should worry about.this means that some code is trying to do string operations on keywords (maybe you already know this)
from your stack overflow thread: > I suppose, neither your application nor the JDK code would ever deal with a clojure.lang.Keyword this is wrong, of course, we use keywords all the time
I've just encountered a strange bug:
labels-probs (sort-by :score >= (map #(do {:score %2 :label %1}) labels clean-probs))
This was crashing for one of my inputs (`clean-probs` is a list of double) with a comparison not respecting contract error. Yet I checked the data, all the elements of the list are valid floats (just, some extremely small, goes to E-39 iirc).
So I figured I might as well do (map #(if (< % 0.001) 0 %)
to clean-probs
and it worked, it doesn't crash anymore
@archibald.pontier_clo your stack trace would probably be useful 🙂
ok I'll get it (it's not accessible anymore, but I can rollback to a commit that had this problem)
i've got a list of tables, and would like to "merge" them in a way such that the new table orders them by element order, i.e
so my three 3x2 tables turn into one 9x2 merged by element. racking my brain on how to do this
does anyone know why this might behave differently in prod (heroku) to local dev?
(defn fn-name
[f]
(as-> (str f) $
(clojure.main/demunge $)
(or (re-find #"(.+)--\d+@" $)
(re-find #"(.+)@" $))
(last $)))
Since it seems to be a pure function, it must be getting a different input param in production. I suggest printing the input param in production, and then you can use that value to reproduce it locally and debug it.
Is there a function available somewhere to abbreviate namespace/package names? e.g. net.eraserhead.foo.bar -> n.e.foo.bar?
@eraserhd what's the use case for abbreviating? require with :as allows that for clojure namespaces, but there's no equivalent for java packages
(require '[clojure.string :as c.s])
This is for logging. I have fully qualified symbols for rule names, and I'm logging a table of fire counts. With the full namespace, it pushes the counts off the screen.
I've seen it in logging excpetions before... I guess it wasn't in the new pretty errors, huh?
@eraserhd I know there are libraries that change default stack trace printing, and I'm sure each logging library has some way to alter how it prints packages
I’m having a bit of trouble understanding why this code continues to realize the sequence: https://pastebin.com/raw/XSsdrLqS You can see a REPL session and clarifying question at the bottom.
(filter vampire?
(map get-details ids))
filter
forces the first lazy seq created by map
to be realizedyou'll need to use transducers if you want to chain them without realizing the whole seq
transducers are a way of composing operations on lazy sequences like map
filter
etc.
@aryyya.xyz See also “chunking”: http://www.tianxiangxiong.com/2016/11/05/chunking-and-laziness-in-clojure.html
@manutter51 Ah ok I think I see some chunking happening. Because if I give a very large range it only seems to realize the first 32 elements.
check this out… I wrote the Fibonacci Sequence in 3 different langs…
feel free to comment on the github and improve it
Are there any good clojure.tools.deps parallel test runners out there? Can’t seem to find any with a google search.
Libraries don't need to explicitly support tools.deps, they just need to be a clojure library
https://github.com/clojure/tools.deps.alpha/wiki/Tools collects a bunch of stuff
Thanks! I’d looked in there but neither of the options for clojure supported running tests in parallel unfortunately.
has anyone ever ran codox
from the command line, or otherwise in the absence of boot
or lein
?
How can I implement a protocol on a value (map with many keys) and retain the ability to update the map without losing the protocol?
this is what defrecord is for
The keys are namespaced, and optional, and numerous, the type of thing you would spec
Or are you suggesting (defrecord [m] …)
why would defrecord care about that?
what I mean, is you use defrecord to define a new map type which extends the protocols / interfaces you are targetting
it doesn't need to define any of those keys in its declaration - you are free to add any key you like
user=> (defrecord Foo [x] Object (toString [this] (str "foo with x:" x)))
user.Foo
user=> (map->Foo {:x 42 :bar/y 4 :z 22})
#user.Foo{:x 42, :bar/y 4, :z 22}
user=> (str *1)
"foo with x:42"
(fixed to include a namespaced key)Thanks, you are right
(assoc *1 ::bar 43) => #user.Foo{:x 42, :y 4, :z 22, :user/bar 43} I did not expect this to work