just the \h <word> returning the unit tests for <word>, and possibly putting somewhere in the \h page a definition of x/a/b/k are. n is inferrable enough, but would harm saying n number type
but perhaps the unit tests will illuminate some of those
@nathanrogers those are not the same. symbols are first class. all arguments are evaluated before the call, so in the first case f will get `g as argument and in the second case whatever the value behind the variable g is.
I don't think my definition will hold much water in this community, but my definition is basically: A language that provides a literal notation for interaction with array, defining operators/functions that treat arrays as primitives
In any bog standard language, 90% of what you're writing that isn't IO is transforming some kind of collection. So the fact that there aren't "primitives" to define such operations is mind-boggling
Most languages provide some kind of array-oriented library, but the code obfuscates the clarity of procedures applied to the data
for a number of reasons. 1 import x from y imports all of y, and only names x in the namespace. For another thing, when refactoring, it is now no longer sufficient to simply search for the library referenced in the code
I can't recall the talk, but one of the language implementors gave both of those disclaimers when using import from. One is the name clobbering, the second is that i makes refactoring code simpler because you can find explicit references to lib in your code because you're naming it explicitly
everywhere I have used python as my day job, that has been sufficient reason for rejecting a PR
just like the code snippet image I sent a moment ago
rw::hs:: its considered bad in most languages to import libraries or modules in that fashion, mostly for name clobbering, but also because it makes explicit which library each function is imported rom
I've seen some Java APIs that use foo.libFn(method(array)) for everything, which kinda solves the problem of doing lib.fn but can be painful to work with sometimes
Scala lets you rename imports, so you can do import com.bar.{longname => ln}, ameliorating that somewhat.
Amusingly I've been trying to figure out whether BQN should have some sort of using facility. It's definitely bad to rely on it too much but I'm not really sure it should be impossible.
@user Yeah, I think so. It would also be impossible to sneak it into a particular scope, since •using (?) would have to appear in that scope to affect it.
⍎ or a likely rename •eval is similar, assuming it even retains the ability to affect the scope that uses it.
@Marshall Scala 3 has a thing called exports that don't automatically leak into the scope that uses it, but they can shorten paths from foo.bar.xyz to foo.xyz.
@user It's namespace destructuring, but using the export arrow ⇐ instead of the normal assignment one.
I really need to write some namespace documentation.
Actually I should probably do that now. It can't be more than a page or two.
Like it's pretty much exactly exports but you can assign the result of the block to a value and destructure it later, or use ns.member to get one of the fields.
(sorry, I can't link to my own message for some reason) The above expression is the list of steps in list order 1. range of ints from 0 to n 2. translate to odd numbers 3. chunk odd numbers into groups of 2 4. get the recriprocal of the product of each 5. 8 times the sum of the reciprocals
or if you just say it in english, 8 times the sum of reciprocal of products of 2 chunks of odd numbers
on reads like a spastic 4 year old coming home from kindergarten "AND THEN AND THEN AND THEN" the other reads like articulate prose
@dzaima that's painfully obvious. an incessant parallel is drawn between the dimensions of vectors and arrays with their mathematical counterpoint. "Oh, but a vector is 1 dimensional, and oh, but a 2 d matrix is 2 dimensional, oh, but a scalar has no dimension which is why ⍴scalar returns ⍬ huehuehue"
if a scalar is truly a parallel for a mathematical point, it is that which has NO PART
if you begin counting by incrementing from 0 by 1 for each thing you count (as this is how you count even but upon your fingers) but you have nothing to count, then you have counted to what number***??????????***
I cannot even begin to COUNT the number of times that parallel has been drawn, not only directed towards myself, but to literally any human being under the sun about why ⍴0 returns ⍬
man you all are just so flexible with how you choose which set of terms to use to describe a domain and when
when an analogy suits a given example, you make concrete claims that are inflexible... until another example crops up, and you don't even recollect your previous claims
@Bubbler you're a mathematician, and a good one. what is your reasoning for ≢scalar ←→ 0? i've always thought it was obvious it should be 1, and i'm in good company.
@ngn To me ≢scalar is mathematically undefined. I don't particularly support it being 0 or 1 or any other value. I just believe defining it as 1 as a special case works good for practical programming.
@nathanrogers what's your definition of "a part" that both describes that "a part" of 2 3 4 5 6⍴0 is 3 4 5 6⍴0, and that is also well-defined on a scalar to give an empty list?
(i'd guess originally ≢ was assigned to return 1 on a scalar to make it easier to write code that uses scalars as single-item vectors)
@Bubbler "there are no axes" and "axes' lengths are supposed to be multiplied" sound like good reasons to accept the multiplicative empty product identity as the answer
APL actually generalises data into a single uniform concept of an array (a tensor if you want) with a (tensor) rank, where a scalar has rank 0, a vector has rank 1, a matrix has rank 2 etc. All functions are generally applicable to all arrays.
I'm just trying to convince you that there is no fundamental difference in the nature of a scalar and any other array. Free yourself from the notion and you loose one more unnecessary complication of thought.
@Bubbler unfortunately apl arrays do not carry information about the group they are part of. a field has an additive group and a multiplicative group as subgroups.
I definitely recall my blood boiling when it became clear that not everything in APL is an array, and that the thing that was said to be not an array was the scalar
That is a conversation that happened
its crap like this that makes me believe in multiverse theory
@ngn it might be a good reason, but by no means at all be a definition. It's talking about a constant number of a single axis, so anything that may apply to many of them is unrelated imo
@ngn right, ≢ ↔ ⊃1,⍨⍴x is one definition, but it's still just special-cases scalars, and the 1 is still gotten from the multiplicative identity which is used because Reasons™
i must disappear, but i'd like to say i have absolutely no doubts about ≢'s definition in the context of linear algebra, and roger absolutely rocks there.
In a scale of 0 to 10 where 0 is "it should obviously be undefined" and 10 is "it should obviously be 1", with an extra choice for "I have a totally different opinion"
I'm currently at 2 or 3, where "I strongly feel it's mathematically undefined, but special-casing it as 1 is an OK compromise for programming purposes"
It's not a joke, it is really like 0÷0 problem, in that different analogies are giving different answers to the ≢0 problem