[HN Gopher] APLcart - Find your way in APL
___________________________________________________________________
APLcart - Find your way in APL
Author : whereistimbo
Score : 99 points
Date : 2023-04-01 03:10 UTC (19 hours ago)
(HTM) web link (aplcart.info)
(TXT) w3m dump (aplcart.info)
| surprisetalk wrote:
| Wow, this is exactly the resource I've been looking for to learn
| APL!
|
| 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.
| JoeAltmaier wrote:
| Because it was cribbed from there.
|
| 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.
| jodrellblank wrote:
| What makes you say it was cribbed from there? The APLCart
| explanation is " _Are all major cells of Y identical?_ " and
| the ChatGPT explanation I got from the prompt "can you
| explain this APL program to me" is:
|
| ---- ----
|
| 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.
| _a_a_a_ wrote:
| Only one data point but I asked a question to my boss and he
| sent me a GPT reply (which he's starting to do rather too
| much these days) which was very incomplete at best, possibly
| outright wrong but also very misleading even if it was right.
| It certainly read authoritatively, caveat emptor.
| skruger wrote:
| APLcart is a searchable idiom collection database -- snippets of
| code that you can search for with a "how do I achieve X" type
| question. I've not seen this for languages outside the Iverson
| family, but it could be equally useful for other languages, too.
| Note that it's accessible from within Dyalog apl as a user
| command: ]aplcart
| t-3 wrote:
| > I've not seen this for languages outside the Iverson family,
| but it could be equally useful for other languages, too.
|
| 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.
| moonchild wrote:
| That's what knuth is, isn't it?
| otabdeveloper4 wrote:
| Best April Fools joke ever.
| rockzom wrote:
| Anybody tried using APL to maximize token context in ChatGPT?
| rgbrgb wrote:
| I had this same thought. The downside would probably be that
| you have a much much smaller set of open codebases to crib from
| and (for me) inevitable bugs will be way harder to spot.
| dintech wrote:
| Nice! I'd love to see this for K also.
| wslh wrote:
| What is the K homepage and source code repository? When I hear
| for K on Internet I read this [1] but confused if it is the
| same of this [2].
|
| https://shakti.com/ [1]
| https://en.wikipedia.org/wiki/K_(programming_language)?wprov...
|
| [2] https://shakti.com/
| t-3 wrote:
| As best I can understand, K is proprietary and you need to
| have a business relationship with Arthur Whitney to get
| access to the latest. You can get a free trial for personal
| use here: https://kx.com/download-kdb/. There are some open
| source clones like: https://codeberg.org/ngn/k
| https://github.com/kevinlawler/kona
| https://github.com/JohnEarnest/ok , and inspired languages:
| http://t3x.org/klong/
| Voklen wrote:
| I've also heard it has a really interesting system for
| creating UIs but cannot find anything about it
| chrispsn wrote:
| https://secwang.github.io/ngnkcart/
___________________________________________________________________
(page generated 2023-04-01 23:03 UTC)