cancel
Showing results for 
Search instead for 
Did you mean: 

Odd behavior of show

josh_helzer
New Contributor
Greetings,

I was reading the reference on _ <http://code.kx.com/wiki/Reference/Underscore#cut>, and in the final example I don't understand the output of show, specifically the trailing line that is "(::;::;::)".  In my session I see slightly different but still odd output:

KDB+ 3.1 2014.07.01 Copyright (C) 1993-2014 Kx Systems
l32/ 4()core 15748MB j m5 127.0.1.1 NONEXPIRE 
q)\l sp.q
q)2 5 7_sp
+`s`p`qty!(`s$`s1`s1`s4;`p$`p3`p4`p5;400 200 100)
+`s`p`qty!(`s$`s1`s2;`p$`p6`p1;100 300)
+`s`p`qty!(`s$`s2`s3`s4`s4`s1;`p$`p2`p2`p2`p4`p5;400 200 200 300 400)
q)count each 2 5 7_sp
3 2 5
q)show each 2 5 7_sp
s  p  qty
---------
s1 p3 400
s1 p4 200
s4 p5 100
s  p  qty
---------
s1 p6 100
s2 p1 300
s  p  qty
---------
s2 p2 400
s3 p2 200
s4 p2 200
s4 p4 300
s1 p5 400
::
::
::

The first two commands show that the third element result of cut has a count of 5, as expected.  But then show shows those extra "::" lines - what are these?

The same obtains with simple numeric lists:

q)2 5 7_til 12
2 3 4
5 6
7 8 9 10 11
q)count each 2 5 7_til 12
3 2 5
q)show each 2 5 7_til 12
2 3 4
5 6
7 8 9 10 11
::
::
::

What's going on?


3 REPLIES 3

charlie
New Contributor II
New Contributor II
:: is the default return value

q)type {}[]
101h

here collected in a list returned from each
e.g.

q){}each til 3
::
::
::

show returns ::

q)show
k){1 .Q.s x;}


Ah ha!  Yes, that makes sense.

Thanks.

You can just put ; at the end of the line to suppress the output if you like:

q)show each 2 5 7_til 12;
2 3 4
5 6
7 8 9 10 11