Fork me on GitHub
#clojure
<
2022-05-21
>
didibus00:05:13

Oh, can you not do (range 13 0) ?

respatialized00:05:56

(range 13 0 -1)

Alex Miller (Clojure team)04:05:22

Default step is 1

👍 1
didibus23:05:07

I guess it would slow it down to be smart enough to detect ascending/descending, make sense.

Carlo11:05:52

I'm imagining a tool for clojure(script) that captures all the transitive execution log from a certain entry point. Imagine, what debux does, but across multiple functions. The execution data could then be queried by specialized interfaces to help with debugging. Think execution as data. Being sexps trees, we also have a fairly natural coordinate system to put the traces in, and than we could have very smart interfaces like this: in our code, put the cursor on a subform in our function, and get back the traces for that subform. debux seems the closest thing that comes to mind, if instead of printing out the information it would collect it in an appropriate data structure. And if it had better extension to multiple functions. Such a tool would also sidestep the problem that it's difficult to have a debugger for cljs like the emacs debugger, due to the single-threaded nature of js. As I'm sure I'm not the first to think about this, what should I look at to find tools with similar ideas or problems I'm not yet seeing?

athos12:05:10

Is something like Postmortem or omni-trace close to what you have in mind? • https://github.com/athos/Postmortemhttps://github.com/Cyrik/omni-trace

Carlo15:05:10

@U0508956F they are very close, I guess omni-trace would be there if it supported cljs, and if it integrated debux for inner-form tracing in a more principled way (allowing multiple inner traces, for example). Or it would be the same if postmortem (thanks btw 🙏 ) had an instrumentation that captures not only the :args and :ret for a function, but also spied with a unique key on every subform (in the spirit of debux .

Carlo15:05:27

The crux of it is using a natural coordinate system for code execution (I'll detail better what I mean in case it's unclear). Does any of this make sense?

borkdude11:05:40

@meditans clojure-lsp has something like a call tree (ingoing and outgoing) based on clj-kondo's analysis data. would that be interesting to look at?

Carlo11:05:55

That's an invaluable feature, but it doesn't collect runtime data (right?). I think it could be interesting as part of the interface for querying, I'll have to think more about it

borkdude11:05:21

It does not collect runtime data, correct. It's based on static analysis

🙌 1
Martynas M15:05:02

Hey. Is there a way to capture last item of transduce? I know that the mapping function has to be side-effect free but... I also transduce into a core.async channel... so I'm not sure what to do. Are there better ways to solve it?

jjttjj16:05:05

not quite sure what you're asking but if you just want to use transduce and only care about the last result you could use a reducing function that just returns the last item:

(transduce (map str) (fn ([acc] acc) ([acc x] x)) nil (range 100))
"99"

Martynas M16:05:57

I want to use transduce and not only care about whole result but my result is already going to be put into a channel. But what I was thinking about is that I need to do some more computations on that result but I don't want to consume the channel. But that's probably some kind of a denial because I don't want to rewire everything. 😄

jjttjj16:05:54

You can use core.async/mult to split the channel so you can consume the same result in multiple locations. Would that help?

Martynas M16:05:56

Thanks. I think that I have a snippet and I try to do too much with it. mult would work but I didn't want to touch the channel. But probably it's better to load everything into memory in advance and not care about much. i.e. if I would load everything into memory it's probably better to avoid frameworkisms... i.e. if I can do it without core.async then I should do it without and then simply calculate using basic seqs

Martynas M17:05:28

I simplified my code even more. Instead of using a transducer that would parse up until specific value I'll now use an infinite lazy sequence and then split-with. I don't yet know whether I'll put it into a channel but that channel could also be replaced by a loop.

emccue15:05:05

on the subject of the maven ecosystem being wacky and wonderful - if one were to make a script for publishing an artifact, could that be done in a "sane" way without involving any of the aether stuff? (like ideally just http calls + gpg or whatever on a directory containing the stuff to publish, maybe generating a publish'd xml?)

Alex Miller (Clojure team)16:05:59

Clojars or Maven Central? It’s … complicated

emccue16:05:45

Maven central let's say

Alex Miller (Clojure team)17:05:33

Most people use the nexus-staging-maven-plugin to push to Maven central, which requires several steps - you push all your artifacts to a staging repository, then release the staging repo (which fails, not infrequently, so you might need to retry), and then you close and drop the staging repo. Replicating that is not impossible (I mean, you're just sending bits over http at the end of the day) but its no picnic.

Alex Miller (Clojure team)17:05:12

Having been in groups trying to do this, we've ultimately chosen to shell out to Maven rather than replicate that

Alex Miller (Clojure team)17:05:15

There is of course some authentication stuff to deal with too

emccue17:05:34

nexus-staging-maven-plugin isn't even up to date with the latest Java and requires add-opens to function

emccue17:05:42

Preaching to the choir, I know

emccue17:05:26

But feeling adventurous today. Going to give it a shot

emccue18:05:40

Good god what is a Mojo

Martynas M17:05:57

Hey. How do I know which functions are included into http://clojuredocs.org? There is a recent new function -- iteration and it's not included. Is there a way to include it there? I'd like to have examples and so on. It exists in here: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/iteration But not in here: https://clojuredocs.org/clojure.core/iteration I like http://clojuredocs.org format better because it's highlighted and nicer to read (also you could take this as a feedback for http://clojure.github.io).

Martin Půda17:05:35

Clojuredocs covers Clojure 1.10.1. There is already https://github.com/zk/clojuredocs/issues/238 to update it.

2