list f ⍨ ←
2 posts
• Page 1 of 1
list f ⍨ ←
⊢z x c←⍳¨3 4 5 ⍝ setI always but always get confused and have to try lots of things in the session before I get algorithms like these correct.
┌─────┬───────┬─────────┐
│0 1 2│0 1 2 3│0 1 2 3 4│
└─────┴───────┴─────────┘
1 2 3↓z x c ⍝ 0
RANK ERROR
1 2 3↓z x c ⍝ 0
∧
1 2 3↓¨z x c ⍝ 1
┌───┬───┬───┐
│1 2│2 3│3 4│
└───┴───┴───┘
z x c↓⍨←1 2 3 ⍝ 2
z x c
┌───┬───┬───┐
│1 2│2 3│3 4│
└───┴───┴───┘
⊢z x c←⍳¨3 4 5 ⍝ reset
┌─────┬───────┬─────────┐
│0 1 2│0 1 2 3│0 1 2 3 4│
└─────┴───────┴─────────┘
z x c↓¨⍨←1 2 3 ⍝ 3
z x c
┌────┬─────┬──────┐
│┌┬┬┐│┌┬┬┬┐│┌┬┬┬┬┐│
│││││││││││││││││││
│└┴┴┘│└┴┴┴┘│└┴┴┴┴┘│
└────┴─────┴──────┘
a b c↓⍨← . . .
a b c/⍨← . . .
a b c↓¨⍨← . . .
a b c/¨⍨← . . .
I can nowhere find any reference to this kind of assignment in the help. Is there such a page? Can we have one if not. One that explains why (2) above works but (0) doesn't even though (3) (which doesn't do at all what I expected) is nearer kin to (1) that it is to (0). (if you know what I mean.)
Actually, having composed the above I'm so conversant with it that I probably won't need the page. For at least a couple of days. But posting anyway in case anyone else is confused.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: list f ⍨ ←
I agree this should be spelled out more in the help:
⍝ Modified assignment includes an implicit each:
v←0 0 0
⎕io←1
v[2 2 3 2] +← 1 ⍝ handy histogram technique
v
0 3 1
)copy dfns tc
... saved ...
v←0 0 0 ⍝ reset
v[2 2 3 2] +tc← 1 ⍝ again with tracing
0 + 1 => 1
1 + 1 => 2
0 + 1 => 1
2 + 1 => 3
i←0
i i i +← 1
i
3
i←0
i i i +tc← 1
0 + 1 => 1
1 + 1 => 2
2 + 1 => 3
⍝ similarly (with ⎕io=1):
z x c←⍳¨3 4 5
z x c ↓tc⍨← 1 2 3 ⍝ with implicit each
1 ↓ 1 2 3 => 2 3
2 ↓ 1 2 3 4 => 3 4
3 ↓ 1 2 3 4 5 => 4 5
z x c←⍳¨3 4 5 ⍝ reset
z x c ↓tc¨⍨← 1 2 3 ⍝ with additional explicit each
1 ↓ 1 =>
1 ↓ 2 =>
1 ↓ 3 =>
2 ↓ 1 =>
2 ↓ 2 =>
2 ↓ 3 =>
2 ↓ 4 =>
3 ↓ 1 =>
3 ↓ 2 =>
3 ↓ 3 =>
3 ↓ 4 =>
3 ↓ 5 =>
- JohnS|Dyalog
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group