Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible array replacement issue #69

Open
ghost opened this issue Apr 20, 2017 · 2 comments
Open

Possible array replacement issue #69

ghost opened this issue Apr 20, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2017

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
Copy link
Owner

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.

@ghost
Copy link
Author

ghost commented Apr 21, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant