Fork me on GitHub
#clojure
<
2024-04-02
>
adham13:04:01

Some personal insight Today I realized that I don't need to call a function prepare-general-stacked-column-chart while it lives in the domain.stacked-column-chart namespace and I can just call it prepare-general-chart as it will become domain.stacked-column-chart/prepare-general-chart in use anyway.

🙌 1
p-himik13:04:36

> it will become domain.stacked-column-chart/prepare-general-chart in use anyway. Only if you use a fully qualified namespace. If you use an alias, it might end up being the-alias/prepare-general-chart. But of course, aliases should be chosen in a way that makes it obvious what it points to. :)

adham13:04:02

The alias ends up being stacked-column-chart/prepare-general-chart in use. This use also only happens in a place specific to domain, so I have domain.subdomain1 and domain.subdomain2 in use so it's not a problem Thank you for pointing this out

adham13:04:55

I shrunk domain.subdomain1.stacked-column-chart in the original message for brevity 😅

👍 1
craftybones16:04:11

A slightly stupid question. The source code for partial has multiple fn definitions for both argument arities and the arities on the closure. Why is this?

craftybones16:04:56

I mean, I am guessing it is for some sort of efficient call. But what exactly makes this an optimal way of writing it?

p-himik16:04:48

Without explicit arities, a vararg function would have to be used. It is simply less efficient.

craftybones16:04:02

The function stops at 3 arguments. I am guessing that is the tipping point between it being efficient and it being ludicrous?

craftybones16:04:58

Though, anything with more than 3 arguments should probably be closed in a different way as opposed to invoking a partial.

Sam Ferrell16:04:58

Specifically an array has to made at runtime to support the varargs, I believe

👍 1
p-himik16:04:25

> I am guessing that is the tipping point between it being efficient and it being ludicrous? That would be my guess, yes.

Alex Miller (Clojure team)16:04:46

we have some ideas about making vararg handling more efficient that may make this unnecessary in the future (tip the balance away from unrolling)

awyeah 1