well... I can't link you a project I worked on where other prominent APLers also do the same sort of fnName ← body to align ← vertically
and I do this in every language, alignment communicates form
that's why lisp and scheme uses an entire editor to make sure it indents according to a given form, even though indentation is fundamentally meaningless
@ngn it separates the dense part - the impl - and the important part - what the result is. The name is usually the most importnt part when scanning through the code, so it should be clearly separated so the brain hopefully would find it quicker when needed
it makes it clear that the simple test cases are grouped on the left, easy to understand, base cases, and as you proceed to the right, more complex, with the most complex at the bottom right
there's a lot of subtext here besides just catenating a list of tuples
and the group can go so far as to lend further clarity as to the amount of brain space each successive column to the right will occupy
@dzaima like, in this chatroom, while reading one message, you can easily "see" that other messages here contain a lot of spaces (and extremely quickly find ones that don't). But you can't tell how many instances of the letter f there are
I can mentally parse that list in text I just pasted, and see that inded they're all tuples, with a distinct patter in the first and second columns of each tuple, or I can space it like I did in the image
you're thinking at the wrong scale, it isn't a letter in a word, it is the capital letter that begins a sentence, it is a column separator, it is a header at the beginning of a set of paragraphs in a text book
it is something which separates, and thus I use it to separate
let's talk about the meta patterns in this section of test case definitions
there are a bunch of patterns inside the patterns of ← and (input expected) vertical alignment
first is that simpler test cases are on the top left, you can almost tell by the blocks of white text where the "." of the particular grouping is. each "day" of aoc is separated inta paragraph-like chunks
and the names are separated from the data, where it is almost intuitive that the left column is input to be tested and the right column is values to expect
the final test case i is always the last one, i being the input from the website that is used to validate you have the correct solution
the extraneous golf examples are at the bottom to lend further visual separation between the groups
there is much more meaning in the whitespace than you're allowing for
if I could eliminate the need for any kind of semantic notation I would, but unfortunately grouping expressions and data is a necessity. I just wish there was a "nice" notation for it, rather than all the brackets and commas and semicolons and colons
@ngn and in this case, if that copy-pastable format wouldn't align the multiple rows, it'd be absolutely unreadable that "passed" corresponds to 54, and presenting which values match with which is the whole purpose of the array
@nathanrogers btw, adrian smith wouldn't have bothered to explicitly release it in the public domain (it's on record), if i hadn't lobbied for dyalog to ask him to (i actually wanted an open-source-like license, not necessarily public domain)
@nathanrogers I don't know why I'm still interested in the language! I do think it's useful for some things, though I've never tried using it for anything besides like art or code golf
I guess I agree with ngn a lot, that it's not fit for most things
I'm convinced that APL is useful for all things, but that we don't have an implementation with all the core features one might expect from a language in a form that programmers and people who write things other than scientific and financial applications would expect them to be in
like , this is as "nice" as most programmers ever get
maybe julia, or if they're really frisky, scheme
but people who have ever bothered to learn scheme or CL past the point of novelty is a fringe minority of the total software industry
most have only ever learned in the context of OO
and then there's the entire world of "engineers who write scripts" who barely know a thing about how programs work and basically just copy past their programs over and over with different static text... they're completely language illiterate but learn a minimal subset of python to get their work done
a LOT of the worlds engineers and scientists are this way, not using mathematica, scheme, lisp, or APL, they're just bolting together whatever hacking disgusting lines of completely non-pythonic mess that they can to just get any kind of output
slapdash is a word that comes to mind
not everyone is at the spearhead of language design research, or getting their doctorate in comp sci to do scientific research. most are just learning python from a youtube video, and making it work
all that said, I don't really have a problem with APL other than the fact that I can't write simple scripts when I need them, and interacting with the environment or filesystem or other programs is completely unpleasant, but doable... I just need professional help every time I try to do something I would consider "normal" as part of my day job
I would have no problem choosing to use APL for an application... I would write wrapper functions for all my filesystem and external interaction and be done with it
@Bubbler still thinking about "tally" and how to define it so 1≡≢scalar is obvious: {⊃⍴⍪⍵}. this definition delegates the question to "table" - why should ⍪scalar return a 1x1 matrix? that could be justified by the fact that ⍪ always preserves the total number of elements. does it sound any more convincing when put like this?
@ngn @dzaima I'd love your spin on golfing this array solution to "snail sorting" or "spiral sorting", ordering a 2d matrix by the outermost layer, spiraling inwards, or the inverse if you're feeling frisky (just reverse the indices :P)
@nathanrogers Temporary variables are just the one-liner's DRY, I don't really take issue with the solution you've got there. However, I had a play with generalising to non-square using basically the same technique you've got there (if posed the problem, I'm with @ngn that the looping encoding is simpler to understand)
@xpqz Conceptually it is a loop (see my webinar on selecting from arrays) but some implementations of some functions applied with rank can be parallelised
@nathanrogers I'm in contact with @code_report - maybe some day we'll do something. It is very nice that he agreed to talk at the APL Seeds event: dyalog.com/apl-seeds-user-meetings/aplseeds21.htm
@nathanrogers I talk through a slight generalisation here youtube.com/watch?v=Isf1b-zblzU although afterwards I realised it doesn't work for matrices with ≤ 2 columns
@ngn @xpqz about the loop question, for me it really depends on how its used. You can absolutely write code that turns ⍤ into not only a conceptual loop, but an inefficient, APL anti-pattern. That really depends more on the structure of the data than the use of ⍤ IMO
@RikedyP also, map in python is idiomatically [f(x) for x in array], or filter [f(x) for x in array if condition], or to provide a default value [f(x) or default for x in array], or combine them with [f(x) or default for x in array if condition]
@nathanrogers what was the reasoning behind using the multi-line function and breaking those parts out into variables? From what I've seen in my short time in the community(I'm not great at APL and I don't use it enough), I would have thought it would be considered un-paradigmatic to break out those simple expressions (the row and column) into separate variables rather than just declaring them inline.
@lambda It's non-idiomatic for the golfing community, but for people who actually write APL in production, they will tell you NEVER to declare names inline
But yes, actually giving names to smaller chunks of expressions is "proper" APL. one liners with inline names like even the one I just pasted from earlier is strictly a golfing idea, and in production is used quite sparingly
@nathanrogers he was here a couple of times and when we pointed out to him that a primitive is not the same as an algorithm, he kept arguing and even seemed offended when he left
his argument was that there's a c++ lib called "algorithms" which serves a similar purpose to apl primitives
@lambda there are various "styles" of APL. you can write pythonic APL no problem, use :FOR:REPEAT:SWITCH:IF etc etc. In fact, GNU APL doesn't even have support for proper DFNS so most of this slick golfing stuff isn't even supported. Most older APLers still write in this Procedural (aka pythonish) style of APL.
@lambda ...(contd) Very few people write in a purely functional fashion like John Scholes or Paul Mansoor, and then you have people like Aaron Hsu who writes in an almost strictly trains fashion in his CO-DFNS compiler
there's an encoding that does something with signs, there's some kind of train that does unique denominators that isn't anything to do with numbers or fractions
I can't name them
but there's all sorts of patterns that would jar a reader who hasn't seen the tricks
and there's ways to write such that any APLer would understand the purpose
interesting that you are saying to not use things that aren't immediately obvious to someone when you suggested f(x) or default as idiomatic python earlier
Maybe a better term than "brevity" is "directness"? I definitely understand the concept: some pieces of code happen to solve the problem in question, and some seem to actually describe how it is solved.
like the community of golfers is not even a fraction of the active APL users
and the styles of APL that are used in production and the sensibilities of people who have to read and write it prefer direct expressions that are parallel to the domain in question
what's the point in using APL if you're going to write code that's as verbose as java, just use java in the first place and then you don't have to deal with the annoyances of APL
@lambda you don't get a clear picture of what "normal" APL looks like either from this chat or from what you'll find in the golfing sections of Stack Overflow.
:Field Public AcceptFrom←⍬ ⍝ IP addresses to accept requests from - empty means accept from any IP address :Field Public AllowFormData←0 ⍝ do we allow POST form data in JSON paradigm? :Field Public AppInitFn←'' ⍝ name of the application "bootstrap" function :Field Public AuthenticateFn←'' ⍝ function name to perform authentication,if empty, no authentication is necessary :Field Public BlockSize←10000 ⍝ Conga block size