Hi,I am very new to KDB+/Q and have a question.d is a general list as follows —d:((1 2 3;4 5 6 7);(8 9;10 ;11 12);(13 14;15 16 17 18;19 20))q)d(1 2 3;4 5 6 7)(8 9;10;11 12)(13 14;15 16 17 18;19 20)q)d[;;0]'typeWhy does d[;;0] give an error ? I was expecting the output to be1 48 10 1113 15 19Is it because there is only 1 element at [1][1] - 10 and if so, whywould it cause this error. Could someone please advise,Thanks,- Raj.
Hi Raj,
>Is it because there is only 1 element at [1][1] - 10 and if so, why
would it cause this error.
Yes, as illustrated by this slightly simpler example
q)d:(1 2;3)
q)d[;0]
'type
q)d:(1 2;(),3)
q)d[;0]
1 3
The type error is coming from the index function. It may be doing something along the lines of if[any 0h>type each x;'type] on each level of nesting.
It has to do this, as you cannot index into a basic atom (q interprets i@j for integers i and j, as the attempt to send the int j to handle i, and so on).
Regards,
Andrew
??
d at [1;1] is an atom and it can’t be indexed that way.
btw “atom @ (values)” means send a message or write to a file
felix
2011/3/11 xbsd :
>
> Hi,
>
> I am very new to KDB+/Q and have a question.
>
> d is a general list as follows —
>
> d:((1 2 3;4 5 6 7);(8 9;10 ;11 12);(13 14;15 16 17 18;19 20))
>
> q)d
> (1 2 3;4 5 6 7)
> (8 9;10;11 12)
> (13 14;15 16 17 18;19 20)
>
>
> q)d[;;0]
> 'type
>
> Why does d[;;0] give an error ? I was expecting the output to be
>
> 1 4
> 8 10 11
> 13 15 19
>
> Is it because there is only 1 element at [1][1] - 10 and if so, why
> would it cause this error. Could someone please advise,
>
>
> Thanks,
>
> - Raj.
>
>
> –
>
Submitted via Google Groups