2022.04.17 11:58 PM
Hi Experts,
I am trying to generate symbol list of each symbol of length 1, however it does work till 16 & considers only symbol till `p but fails when length is more than 16.
L1:-16?`1; //works
asc L1 //`a`b`c`d`e`f`g`h`i`j`k`l`m`n`o`p
L1:-17?`1; //'length error
Same is the case with , when we try to create a symbol list of each symbol of length 2.
asc -256?`2 //generate symbol list with combination till ....`pp
asc -257?`2 //'length error
My question is why does it considers symbols till `p only ?
Thanks,
Vajindar.
2022.04.18 12:26 AM
The range of generate for symbols is only from abcdefghijklmnop as documented here: https://code.kx.com/q/ref/deal/#roll-and-deal
As to why is that so, I have no idea as well.
But you can use something like this to solve your problem:
q){[num;len] neg[num]?`${.Q.a cross x}/[len-1;enlist each .Q.a]}[17;1]
`e`n`d`g`r`y`b`p`j`l`s`i`f`k`w`u`c
q)asc{[num;len] neg[num]?`${.Q.a cross x}/[len-1;enlist each .Q.a]}[256;2]
`s#`af`an`aq`as`ax`ay`ba`bd`be`bj`bk`bl`bn`bo`bu`bw`ca`cb`cc`cd`cf`cn`co`cq`c..
2022.04.25 08:25 AM
p is the 16th letter of the alphabet. not likely a coincidence.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.