KX Community

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

Home Forums kdb+ How to understand the meaning of (3#,:)

  • How to understand the meaning of (3#,:)

    Posted by danielhk on July 9, 2022 at 12:00 am

    Dear All,

    Could you please help me explain the meaning (3#,:)

    I understand “3#” is taking 3 elements and “,” is to join

    but don’t understand the “:” here.

    and don’t understand the meaning of  (3#,:)

    q)z
    “abcde”
    “fghij”

    q)(3#,:)z
    “abcde” “fghij”
    “abcde” “fghij”
    “abcde” “fghij”

    danielhk replied 8 months, 1 week ago 2 Members · 2 Replies
  • 2 Replies
  • danielhk

    Member
    July 9, 2022 at 12:00 am

    I just found ,: means  Amend At.

    but still a little difficult to understand the result

  • fbodon

    Member
    July 10, 2022 at 12:00 am

    This is implicit composition (). You can see this from the parse tree:

     

    q)parse "(3#,:)" 
    ' 
    (#;3) 
    ,:

     

    In k, the expression ,: corresponds to enlist. This construct is the same as repetition (*) in Python.

    See: https://code.kx.com/q/ref/compose/

Log in to reply.