This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-16
Channels
- # aleph (1)
- # aws (1)
- # beginners (23)
- # boot (33)
- # cider (15)
- # cljs-dev (4)
- # clojure (73)
- # clojure-dev (18)
- # clojure-italy (8)
- # clojure-russia (7)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (118)
- # clojure-ukraine (3)
- # clojurescript (34)
- # code-art (1)
- # community-development (24)
- # cursive (21)
- # data-science (3)
- # datomic (72)
- # defnpodcast (1)
- # fulcro (77)
- # graphql (4)
- # hoplon (8)
- # jobs (3)
- # luminus (3)
- # lumo (7)
- # off-topic (3)
- # onyx (17)
- # other-languages (7)
- # pedestal (1)
- # perun (1)
- # protorepl (21)
- # re-frame (91)
- # ring (4)
- # ring-swagger (18)
- # shadow-cljs (22)
- # spacemacs (37)
- # specter (1)
- # sql (23)
- # test-check (4)
- # unrepl (29)
- # utah-clojurians (3)
- # vim (36)
- # yada (10)
Is there a way to show âsimplerâ java objects:
[#object[edu.stanford.nlp.ling.TaggedWord 0x6a16b1ef "Short/JJ"]]
->
[#<TaggedWord Short/JJ>]
are you talking about how java objects are printed?
@smith.adriane I tought I could get this construct [#<TaggedWord Short/JJ>]
from/instead of this construct [#object[edu.stanford.nlp.ling.TaggedWord 0x6a16b1ef "Short/JJ"]]
in the repl.
Using prn doesnât seem to change anything
I think if you can change how itâs printed by overriding the print-method
(defmethod print-method edu.stanford.nlp.ling.TaggedWord [v ^java.io.Writer w]
(print-method "[#<TaggedWord Short/JJ>]" w))
@smith.adriane wow! Thanks! Works like a charm!
oh wait
would need to make dynamic this part: Short/JJ
@smith.adriane this does it:
(defmethod clojure.core/print-method edu.stanford.nlp.ling.TaggedWord
[piece writer]
(.write writer (str â#<TaggedWord â (.toString piece) â>â)))
Thanks again!
Is this a good practice?
(def printed-objects [CoreLabel TaggedWord Word])
(defn set-print-methods! [print-objects]
(doseq [o print-objects]
(defmethod print-method o
[piece ^java.io.Writer writer]
(.write
writer
(str â#<â (.getSimpleName o) â â (.toString piece) â>â)))))
(set-print-methods! printed-objects)
(-> âShort and sweet.â tokenize pos-tag)
;;=> [#<TaggedWord Short/JJ> #<TaggedWord and/CC> #<TaggedWord sweet/JJ> #<TaggedWord ./.>]
I have two channels. One sends frequent, but low-priority messages. Another sends infrequent, but high-priority messages. I want to process messages from these channels sequentially. If a message is available on the high-priority channel, I want to process that message before the low priority channel is considered.
In essence, is there some variant of alts!
that I can use/build that has a deterministic order in which it takes from channels?
You can specify :priority true
after the channel and handler forms to indicate that the channels should be tried in declared order.
hi guys. I'm using Cursive to develop & debug our Clojure apps, often experimenting things with the REPL. I wonder if there is an efficient way to create datastructures in the REPL sourced from a Debug breakpoint - e.g. if I have a complex datastructure, which I'd like to work with in the REPL as well (to test functions, debug etc...), how can I have a var referencing it the easiest way in the REPL? Of course I dont want to type the whole thing in the REPL, but would like to get the data from an app under- debugging (say I have a breakpoint and the object is there)?
@andras.liter perhaps def
?
It should be generally avoided inside functions but I guess it's fine for debugging.
;; let's say I want to get `m`
(defn debug-me [x y]
(let [z (* x y)
w (Math/pow z x)
m {:x x
:y y
:wz {:z z :w w}}]
(def d-m m)
(keys m)))
(debug-me 4 5)
d-m
@jumar @andras.liter Yes, def
should work for this. When stopped at your breakpoint, use Evaluate Expression to do something like: (def test-data-var (my-expr))
- that should work fine.
Iâm actually planning to try to have the REPL work when stopped at a breakpoint, but thereâs some trickiness there when the user changes context (i.e. clicks on a higher stack frame)
{:keys [ .... ]} works with unqualified names. Does it also work with qualified names (from other namespaces)? intuition says no, since there could be more than one match, and there's no obvious way which to pick.
thanks for the responses @jumar @cfleming @qqq Indeed, def
can be used - was too obviuos for me to find it đ
@raymcdermott we use a custom macro like this:
and then something like (with-cleanup [r (make-resource) .shutdown] ...)
in the end you can also just write out a (let [r (make-resource)] (try .... (finally (.shutdown r))
@andras.liter if you might also want to use the data in a regression test, I wrote a library that simplifies stashing the clojure data to disk and re-inflating it to use it in test code
what are some highly-considered db migration libraries (mysql specific?)
Calling Flyway (Java lib) from Clojure is just a few lines of code
good point, I always forget I can reach for java đ
Calling Flyway (Java lib) from Clojure is just a few lines of code
@rcolyer Mostly, yes. Thereâs some doc here about problems: https://github.com/cursive-ide/cursive/wiki/IdeaVim-issues
Certainly there are Cursive users using it, and most seem to consider it more or less EVIL-level emulation.
I have it mostly done, itâs waiting on a couple of outstanding bugs. Shaun was hopefully going to find time to look at them soon. Once theyâre fixed itâll be good to go.
IdeaVim seems to have many issues on its own that are frustrating. I can never get certain leader combinations to work properly
they seem to be known issues....I'm resigned to carpal tunnel syndrome on some of the action with some hideous ctrl-alt-shift-....if I just had one more pinkie" combination
Hi, this is beginner stuff, an exercise to re-implement boolean: (defn boolean [x] (if (x == "false") false (if (x == "nil") false true)))
user> (boolean "asd") java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
@lum assuming you were wanting to output based on string values (cond (= x "false") false (= x "nil") false true)
(x == "false")
I think you want (= x "false")
depending on what youâre actually testing for
the string false
or the value false
but, the root cause, (x == "false")
is not doing what you think itâs doing
there is a #beginners channel that may be helpful for you
yes, this is for the http://mooc.fi course, I'll see how the tests go, but that one was really noob
@rcolyer Years ago I bought one of these and have used one for heavy typing ever since -- not cheap, but way cheaper than wrist surgery. Puts most of those modifier keys under your thumbs, and the keys are programmable, too. https://www.kinesis-ergo.com/shop/advantage2/
@andy.fingerhut nice. I use this https://www.microsoft.com/accessories/en-us/products/keyboards/sculpt-ergonomic-desktop/l5v-00001
@andy.fingerhut nice. I use this https://www.microsoft.com/accessories/en-us/products/keyboards/sculpt-ergonomic-desktop/l5v-00001
@andy.fingerhut you use footpedals?
I have them, but have only used them on occasions when I was transcribing some audio lectures, where i mapped foot pedals to play/pause on the audio. I do use VI key bindings inside of Emacs, too, just to be weird, although there are still plenty of control keys I use too often for my own good.
(Sorry, Clojure denizens, we can take this privately if it gets too much longer)