Fork me on GitHub
#clojure
<
2021-12-02
>
sova-soars-the-sora00:12:04

Hi is there a way to rebind *out* to a connected nRepl so some [a subset] of my printlns will go to a specific repl instance?

sova-soars-the-sora00:12:13

Something like

(binding [*out* ???]
  (println "Send me to the Repl pls"))
Not sure what goes into the ???

hiredman01:12:51

What nrepl client? How is the thread the printing code is running on created?

hiredman01:12:27

Some nrepl clients don't seem to support async output at all (the nrepl sending random output whenever)

sova-soars-the-sora02:12:05

In this case, messing around w/ IntelliJ (Cursive) nRepl And the program is running as a separate process (started from terminal)

dergutemoritz10:12:01

Heya, for some reason I am unable to create, comment on or subscribe to JIRA issues anymore. It always says "You are not authorized to perform this operation. Please log in." But when I try to do that, I am supposedly already logged in but says on the account selection screen that my logged-in account "doesn't have access to Jira on http://clojure.atlassian.net" (even with a freshly created account). Does anyone know what's up with that?

Alex Miller (Clojure team)12:12:32

We only give out jira edit access to people supplying patches (our jira logins are finite). The preferred place for creating and commenting on issues is https://ask.clojure.org

dergutemoritz13:12:49

IC, thanks! I guess my only gripe then is how to subscribe to issues I'm interested in - JIRA activity isn't synced to http://ask.clojure.org so subscribing there doesn't do the trick 😕

Alex Miller (Clojure team)13:12:57

Discussion should mostly happen on ask and you can get notified about ask issues, don't remember what affordances are there to watch

Alex Miller (Clojure team)13:12:49

And I do come back and close the ask issue if we resolve the jira

Alex Miller (Clojure team)13:12:00

It's not perfect, admittedly

dergutemoritz13:12:23

Ah cool, I guess that covers at least 95% of my desires then 🙂 Yeah, the usual imperfections of real-world infrastructure I suppose, hehe

vncz13:12:27

Can I update multiple keys in a Map using update ?

flowthing13:12:23

Not with a single call. You can use the thread-first macro, though:

user=> (-> {:a 1 :b 2} (update :a inc) (update :b dec))
{:a 2, :b 1}

vncz13:12:58

I guess, but I am using it in a condp macro where I can only provide 1 statement

vncz13:12:00

Any suggestion?

vncz13:12:30

Well actually the threading macro will just do

flowthing13:12:56

Yeah, I don't see how condp would prevent you from using ->.

Marc O'Morain13:12:02

I love the new addition to the reify docstring in 1.11. I’m currently reading the reduce doctring and it suffers from the same issue – it explains how the function operates, but not “why”. Would it be helpful to add a one line synopsis? something along the lines of “compute an aggregate result from the values in coll” ?

Alex Miller (Clojure team)14:12:29

file a question on ask ...

👍 1
Thierry15:12:42

Does anyone know if the VSCode Calva Jack-in terminal window gets logged somewhere?

Noah Bogart15:12:45

probably best to ask in #calva

Thierry15:12:34

just saw I am only in a select set of channels, will do thanks.

Noah Bogart15:12:36

glad to help! I’d recommend looking through the channel list, joining (and then muting) the channels for various libraries you use. it’s a great way to get feedback/help without being overwhelmed by too many notifications lol

2
👍 1
pez16:12:40

For the #calva channel, especially if you mute it, please consider adding a Notification Keyword calva friend. I use that for announcement type messages. Then slack will badge the channel for those messages.

👍 1
Noah Bogart16:12:49

oh that’s excellent, i didn’t realize you did that

pez19:12:45

Maybe I should advertise it a bit. 😀

vncz15:12:14

Any suggestion on how to thread only once without having to use as-> ?

dpsutton16:12:37

I believe you can just

(-> "./input/day2input.txt"
    slurp
    str/split-lines
    (->> (map #(split % #" "))
         (map (fn [[x y]] [x (Integer/parseInt y)]))
         (into [])))
the thread first will plop it in the first position and the thread last will do the right thing from there

dpsutton16:12:05

or you can combine the first few

(->> (split-lines (slurp "./input/day2input.txt"))
     (map #(split % #" "))
     (map (fn [[x y]] [x (Integer/parseInt y)]))
     (into []))

vncz16:12:05

Oh right

vncz16:12:06

Very good point, thank you

emccue16:12:32

(->> (split-lines (slurp "./input/day2input.txt"))
     (map #(split % #" "))
     (mapv (fn [[x y]] [x (Integer/parseInt y)])))

emccue16:12:40

don’t need the last into with a mapv

vncz16:12:53

That I did not know either

Björn Ebbinghaus16:12:43

What most people overlooked is that I provided an implementation you can use with https://github.com/vlaaad/tweet-def… :-)

user=> (require '[io.github.vlaaad.tweet-def :as tweet])
nil
user=> (tweet/def "")
#'user/↯
(↯
  "WTE"
  (reverse)
  (mapv int)
  (update 0 inc)
  (map char)
  (reverse)
  (apply str))
"WTF"
https://twitter.com/MrEbbinghaus/status/1463192005429891076

vncz15:12:37

(yeah, advent of code) trollface

diego.videco17:12:25

I am wanting learn more about how the basic clojure macros (def, defn, let*, if), etc. are implemented, but haven't been able toe easily find where they are defined, can someone point me in the right direction?

Alex Miller (Clojure team)17:12:37

they are mostly implemented in the Compiler as they are special forms

Alex Miller (Clojure team)17:12:56

you have to bottom out somewhere - this is the place! :)

Alex Miller (Clojure team)17:12:53

the parse method is parsing a let* form, the doEmit is emitting Java bytecode

sun-one18:12:49

From the list you mentioned defn is a relatively simple macro JFYI @diego.vid.eco you can always run (source macro/fn-name) from the repl to see how functions and macros are implemented in the CLJ language. Though as pointed out def and if, let* are unique axioms of the language.

sun-one18:12:02

It also helps if your editor has go-to functionality but I tend to just run (source) fn from repl.

diego.videco18:12:39

Thanks @chesslunatic. I was confused because on the source it seems like defn is declared with def but now I see that afterwards there is a call to (. (var defn) (setMacro)) which I suppose does some sort of conversion of it to a macro.

Alex Miller (Clojure team)18:12:15

a macro is just a function that takes code data and returns data

Alex Miller (Clojure team)18:12:28

the flag is what tells the compiler to expand when it analyzes