@KamilaSzewczyk Sorry about that. Th other links do contain examples, though, and there are four more here. That said, we should add some more content. Do you feel like doing so once you get a good grip on the subject?
sure thing, after I learn operators I can make the article a bit better
Also page 13 of APL tutor about evaluation order seems kinda off?
> No APL expression needs to end with a closing parenthesis
how would one rewrite, say, ×/(+.!∘⌽⍨∘⍳¨1+∘⍳⊢), to not need a closing parenthesis at the end? Simply stripping it off doesn't help
if I enable boxing, it's evident that it's split into the ×/, +.!∘⌽⍨∘⍳¨ and 1+∘⍳⊢ boxes without parens (instead of the last two being in a single box).
@KamilaSzewczyk One could argue that that isn't an expression, but rather a function phrase, even even so, the statement is less than accurate. How about 1(2 3)? More precise would be that any trailing expression for an entire array never needs parenthesis.
btw, tryapl feels better than before. nice language bar :) but after staring at it for a while, i started seeing a green rectange every time i blink :)
@phantomics The problem is that people can always adjust their screen for less contrast, but some people have poor eyesight and appreciate the availability of full contrast.
That's why APLcart has a high-contrast black mode, not just the low-contrast dark TIO-like grey mode.
@Adám I see, I haven't heard complaints about the Solarized color scheme's light and dark modes being unusable for people with vision problems, I would go with a similar level of contract, not something totally washed out
@Razetime not yet. i was planning to study @xpqz's solution from yesterday, but today's problem is still fresh in my head and it might be better to port it now
@ngn Interesting point, I suppose my ideal would be to have 4 color modes you could flip through by clicking a button, not at separate URLs. Two light, two dark, two with intense b/w contrast, two with a bit less contrast
i've noticed a few interesting things after coding for many years. i don't wear glasses. the clarity of my vision depends on how tired i am. when i'm tired, my vision is a bit blurred, so i appreciate the contrast.
in a dark scheme, i've noticed i care much more about the black than the white. the white could be "toned down" and still look great. but when the black is grey, i find it annoying.
I have strong astigmatism, and dark background is not only difficult for me to use. I get physically affected by it.
If there was a way to permanently set it to black-on-white so I could follow links to tryapl, that would be great. For me, right now, I prefer not to click on the link because the effect comes very quick if I actually attempt to read anything.
@EliasMårtenson astigmatism causes blurring, right? how does the prevalence of black (lack of light) affect you more than white (being bombarded with photons)?
That said, we could add a low-contrast setting to TryAPL, and we could save your colour scheme preference locally, and let that override whatever permalink you use.
@ngn Well, it's an actual effect (head starts spinning, things starts to float in front of my eyes, it's incredibly uncomfortable) and it's quite common, I have learned. The only physical explanation that sounded plausible was that with less light, the iris opens up, which reduces the FoV (just like low F-stop on a camera). This causes the eyes to work harder to keep things in focus.
@dzaima No, that would be the case if it all was by design, but we didn't actually think of storing that setting in localstorage. I'll log an issue to switch to using localstorage instead of URL param.
@Razetime Ah, sounds like it was designed expecting one-by-one keypresses, not pasting a lot at once. It should of course discard any further input when it first complains. Can you log an issue?
Good progress with my MENACE project. Here's a complete game player. This version just makes random moves but I have the extra code to do MENACE stype Reinforcement Leaning. It just need s stitching together.
⎕io ← 0
show ← {3 3⍴⍤ 1 ⊢'.×○'[⍵]} ⍝ display position list ← {⊂⍤2 show ⍵} ⍝ spread boards across the page ild ← {(⊂⍺) ⌷[¯1+⍴⍴⍵]⍵} ⍝ index last dimension np ← {1+>/+/1 2∘.=⍵} ⍝ next player cg ← {0⊃⍵} ⍝ current game from config p ← {,¯1↑⍵} ⍝ current position from game random_player ← {cf ← ⍵ ⋄ g ← cg ⍵ ⋄ cp ← p g ⋄ i ← ⍸e←0=cp ⋄ cp[i[?+/e]] ← np cp ⋄ g ← g⍪ cp ⋄ cf[0]←⊂g ⋄ cf } wpi ← {rows ← ⍵ ⋄ cols ← ⍉⍵ ⋄ diagonals ← 2 3⍴↑(0 0⍉⍵) (0 0⍉⌽⍵) ⋄ ⊃⍪/rows cols diagonals} 3 3⍴⍳9 ⍝ winning indices wf ← {∨⌿∨/^/1 2∘.=wpi ild ⍵} ⍝ is this a win?
You can link to one. (If it is available online, of course.)
@RomillyCocking No big deal. The biggest issue is when people post a single line of APL without backticks or code-blocking it, as that keeps markdown active, and some APL code can be misunderstood as markdown.
@RomillyCocking No, then you need the code-block. If Ctrl+k doesn't work, and you don't see the button, you can make sure every like has at least 4 leading spaces.
okay, so I got to your solution via: ((2|⊢){⍵/⍨⍺⍺⍵}) -> ((2|⊢){(⍺⍺⍵)/⍵}) ->({((2|⊢)⍵)/⍵}) -> ({((2|⊢)⍵)}⊢⍤/{⍵}) -> (((2|⊢)⊢)⊢⍤/⊢) -> ((2|⊢)⊢⍤/⊢) -> 2∘|⊢⍤/⊢
Exactly. One way to think of it is that the right argument of every function is the entire expression on its right, as far as it can reach, i.e. until the end of the line/statement/parenthesis.
So what you want here, is to let ⍳ use just 10 as its argument, giving you ten indices, then let × use that as its right argument, then let - use that as its left argument, which means you need a parenthesis.
OK, so you already know a few built-in APL symbols. They called primitive functions.
Primitive functions are either dyadic (take two arguments), like multiplication, or monadic (take one argument), like negation. Most primitive functions use a symbol shared between a monadic and a dyadic function.
E.g. dyadic - is subtraction, while monadic - is negation.
Often, the two are closely related, e.g. with the monadic form being like the dyadic one with a default left argument of some sort.
@Konrad'Unrooted'Klawikowski Dyadic ÷ is division. Can you guess what monadic ÷ is?
Well, functions either take one or two arguments, so yes. That said, an argument can be an array, but that doesn't usually make a difference to the actually meaning.