APLcart – Find your way in APL
aplcart.info
aplcart.info
The closest thing would probably be Rosetta Code. Iversonian languages seem to be relatively unique in their rejection of defined functions in favor of composition of language primitives, so it seems that libraries are reached for before idiomatic expressions in other langs. It seems like an algorithm dictionary in plaintext or pseudocode would be a great boon for all.
https://shakti.com/ [1] https://en.wikipedia.org/wiki/K_(programming_language)?wprov...
I took one of the idioms and posted it into ChatGPT:
Can you explain this APL program to me?
(1=≢∘∪)Y
It gave me an extremely helpful breakdown, and its analysis matched the description on APLcart.If you know an authoritative source of information on a subject, for God's sake don't ask ChatGPT on the hope it will find it too, parrot it back, because it has a high probability of putting unrelated but plausible-sounding shit in there. Leaving you to sort out what's real and what's statistically-related nonsense.
---- ----
Certainly! Let's break down the APL program (1=≢∘∪)Y step by step.
First, let's focus on the function ≢∘∪. The symbol ∘ is called the "composition" operator, which means it takes two functions and returns a new function that applies the second function to the result of the first function. In this case, ≢ and ∪ are the two functions being composed.
≢ is the "tally" or "count" function, which returns the number of items in an array. For example, ≢ 'Hello' would return 5.
∪ is the "unique" function, which removes duplicates from an array. For example, ∪ 1 2 3 3 4 would return 1 2 3 4.
So, ≢∘∪ means "count the number of unique items in the array". For example, if Y is 1 2 3 3 4, then ≢∘∪ Y would return 4, because there are 4 unique items in the array.
Now, let's look at the entire program: (1=≢∘∪)Y
The parentheses are used to group the functions together, so that they are treated as a single function.
1= compares the result of ≢∘∪ Y to 1. If the result is equal to 1, then 1= returns 1 (true). Otherwise, it returns 0 (false).
So the entire program (1=≢∘∪)Y means "return true if there is only one unique item in the array Y, and false otherwise".
---- ----
That doesn't seem like a crib from the APLCart sentence at all. And this explanation is correct as far as it goes - it just doesn't go far enough to mention "major cells" (i.e. it would deduplicate the rows of a 2D matrix, not the individual elements). And it doesn't mention parentheses around the pattern (constant function function) is significant and makes a 'train' but then neither does the APLCart one.