Reputation: 14926
How may I display an entire list, or control the number of elements displayed, on the console? I tried show
and searched a bit but am unsure where to look next.
q)til 100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 6..
Upvotes: 0
Views: 2124
Reputation: 3179
You can adjust the console size like so
q)til 100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65..
q)\c 20 50
q)til 100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ..
q)\c 20 10
q)til 100
0 1 2 3..
More detail on adjusting the console size can be found here https://code.kx.com/q4m3/13_Commands_and_System_Variables/#1322-console-size-c
Upvotes: 2
Reputation: 1131
The console height & width is controlled by this: https://code.kx.com/q/basics/syscmds/#c-console-size
However, if you need to escape those boundaries without modifying the settings, you can do something like
q)\c 10 30
q)til 20
0 1 2 3 4 5 6 7 8 9 10 11 1..
q)
q)-1" "sv string til 20;
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
q)
q)// or
q)
q)-1 .Q.s2 enlist til 20;
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
.Q.s2
can be used for other structures but bear in mind, like other 'deeper' .Q functions, .Q.s2 is undocumented and could be subject to change
q)t:flip (20#`abcd)!2?/:20#10
q)t
abcd abcd abcd abcd abcd ab..
---------------------------..
6 3 8 8 8 4 ..
1 2 2 5 7 1 ..
q)
q)-1 .Q.s2 t;
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd
---------------------------------------------------------------------------------------------------
6 3 8 8 8 4 9 9 3 9 5 0 9 6 5 9 7 3 9 8
1 2 2 5 7 1 6 4 0 2 8 1 5 5 4 1 2 4 4 3
Upvotes: 3