KX Community

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

Home Forums KX Solutions joining strings kdb+

Tagged: ,

  • joining strings kdb+

    Posted by kdb_newbie on May 27, 2025 at 8:13 am

    why does joining these 2 strings give unexpected results?
    -> system”pwd” = and the type is 0h as well
    -> (system”pwd”),”/xyz.csv” //type of first string is 0h and type of “xyz.csv” is 10h as expected

    rocuinneagain replied 3 days, 14 hours ago 3 Members · 2 Replies
  • 2 Replies
  • ss1

    Member
    May 27, 2025 at 8:33 am

    https://code.kx.com/q/ref/system/ “returns the result as a list of character vectors.”

    Returns a list (0h) of character vectors (10h).

    q)type system”ls -l”

    0h

    q)count system”ls -l”

    28

    q)type system”pwd”

    0h

    q)count system”pwd”

    1

    q)first system”pwd”

    “/Users/myuser”

    q)type first system”pwd”

    10h

    q)(first system”pwd”),”/some”

    “/Users/myuser/some”

  • rocuinneagain

    Member
    May 27, 2025 at 9:11 am

    It’s joining a list (of lists) to another list (of characters)

    q)(system"pwd"),"/xyz.csv"
    "/home/rocuinneagain"
    "/"
    "x"
    "y"
    "z"
    "."
    "c"
    "s"
    "v"

    To join a list of lists to another list of lists add ‘enlist’

    q)(system"pwd"),enlist "/xyz.csv"
    "/home/rocuinneagain"
    "/xyz.csv"

    To add a list of characters to a list of characters use ‘first’

    q)(first system"pwd"),"/xyz.csv"
    "/home/rocuinneagain/xyz.csv"

Log in to reply.