Thanks for sharing this! I don’t know who the intended audience is, but as a beginner, I’d really appreciate some explanation of not just the “what is happening” which you do include, but also “how it is happening”.
For example, I can (sort of) make sense of the first statement:
⍝ Create some data for us to sample
⎕←V ← 5?10
Draw 5 random numbers from 1 to 10 and assign to V and also display to screen.
But, for the next one, things get tricky for me:
⍝ Get random sample of indexes
So I tried to work through it, but not knowing where the logical boundaries are, I just went from right to left.
`⍴V` just gives me 5 which means it must be just the length of the V vector.
`/⍴V` gives me error ... which tells me I need to have something to the left
`10/⍴V` gives me a 10 item vector filled with 5's
`?10 /⍴V` gives me a 10 item vector with random values between 1 to 5
But then the question is: Where are the logical boundaries? are
⍴V LHS and RHS to operator (or function) “
So, as you can see, not knowing ‘trains’ and precedence rules for all the operators involved (or even not knowing whether the thing I’m looking at is an operator or function, and in what role it is being used,) it’s slow going for newcomers.
If there were some basic comments on not just the “what’s happening” but also “how it’s happening and why it’s happening the way it’s happening?” , it would help immensely towards understanding, but then again, it all depends on the audience, and if it’s not meant for the newbs, then that’s fine too, please ignore.