Possible array replacement issue
snddns opened this issue · 2 comments
snddns commented
In oK:
test: 6 3 # 30 34 77 61 70 36 12 97 92 99 45 83 94 8 97 52 66 24
(30 34 77
61 70 36
12 97 92
99 45 83
94 8 97
52 66 24)
test[0 5;0 2]:2 2 # 1 2 3 4
(3
61 70 36
4
99 45 83
94 8 97
2)
But I get the expected behavior here (with less pretty printing):
KDB+ 3.4 2016.10.10 Copyright (C) 1993-2016 Kx Systems
l32/ 4()core 7884MB snd snd 127.0.1.1 NONEXPIRE
q)\
test: 6 3 # 30 34 77 61 70 36 12 97 92 99 45 83 94 8 97 52 66 24
(30 34 77;61 70 36;12 97 92;99 45 83;94 8 97;52 66 24)
test[0 5;0 2]:2 2 # 1 2 3 4
test
(1 34 2;61 70 36;12 97 92;99 45 83;94 8 97;3 66 4)
JohnEarnest commented
In k6, this type of "spread assignment" doesn't appear to work at all:
2016.12.02 (c) arthur whitney
test: 6 3 # 30 34 77 61 70 36 12 97 92 99 45 83 94 8 97 52 66 24
test[0 5;0 2]:2 2 # 1 2 3 4
test[0 5;0 2]:2 2 # 1 2 3 4
^
parse error
However, it did work in k5 as you expect:
2015.04.05 (c) arthur whitney
test: 6 3 # 30 34 77 61 70 36 12 97 92 99 45 83 94 8 97 52 66 24
test[0 5;0 2]:2 2 # 1 2 3 4
test
(1 34 2;61 70 36;12 97 92;99 45 83;94 8 97;3 66 4)
I think the k5/k4 behavior is clearly more useful. Lots of fiddly details to this sort of thing.
Deleted user commented
Ah, okay, thanks. That confused me for a bit; thought it should work. Trying to keep all of the differences straight.
Just realized it would be easier if I had a copy of the k5 and k6 interpreters. I should ask Arthur Whitney at some point.