qi
qi copied to clipboard
Define identity elements for `-<` and `==*` and name some flows.
Summary of Changes
As a kind of Cartesian Product, Values
's identity element (values)
can be marked as 1
.
-<
and ==* can be regarded as monoids with identity elements *->1
and 1->1
respectively.
Public Domain Dedication
- [x] In contributing, I relinquish any copyright claims on my contribution and freely release it into the public domain in the simple hope that it will provide value.
(Why: The freely released, copyright-free work in this repository represents an investment in a better way of doing things called attribution-based economics. Attribution-based economics is based on the simple idea that we gain more by giving more, not by holding on to things that, truly, we could only create because we, in our turn, received from others. As it turns out, an economic system based on attribution -- where those who give more are more empowered -- is significantly more efficient than capitalism while also being stable and fair (unlike capitalism, on both counts), giving it transformative power to elevate the human condition and address the problems that face us today along with a host of others that have been intractable since the beginning. You can help make this a reality by releasing your work in the same way -- freely into the public domain in the simple hope of providing value. Learn more about attribution-based economics at drym.org, tell your friends, do your part.)
I wonder if some forms can be abstracted as functions? like X
, ⏚
and n>
(it seems that the forms without parentheses can be handled like this?).
Yeah, @benknoble also pointed this out recently and it ended up making a big difference in performance in that case. It would be great to have implementations behind functions if there is no compile-time benefit to defining the macro in-place. For instance with the threading form ~>
, it makes sense to use a syntactic expansion instead of a function as it gives us a performance benefit (otherwise we would need to reverse the order of composition at runtime using reverse
, instead of doing it syntactically at compile time). I haven't done a review of cases where a function would work, and I think you're right that the pure-identifier forms would all be abstractable as functions.
I haven't had a chance to review this PR (and some of your other PRs! 😅 ) yet, but on a logistical note, abstracting forms behind functions sounds like it would be best to do in a separate PR (or PRs) to keep them narrowly scoped.