KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Generating unique symbol list does not consider symbols after `p

  • Generating unique symbol list does not consider symbols after `p

    Posted by vajindarladdad on April 18, 2022 at 12:00 am

    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.

     

     

     

    vajindarladdad replied 8 months ago 3 Members · 2 Replies
  • 2 Replies
  • mauricelim

    Member
    April 18, 2022 at 12:00 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..

     

  • rolf

    Member
    April 25, 2022 at 12:00 am

    p is the 16th letter of the alphabet.  not likely a coincidence.

Log in to reply.