stringlisteachkdb+

kdb uses the symbol ' to compare strings one by one


I want to use ' to compare strings in a list, the code is as follows: "tbl" ~'("customer";"tbl") but reported an error:“length: Incompatible list lengths”。

The result I want to get is 01b This can be done with each: {"tbl"~ x} each ("customer";"tbl") Please tell me how to accomplish this task with '


Solution

  • Instead of each-both ' you want to use each-right /:

    "tbl"~/:("customer";"tbl")
    01b
    

    https://code.kx.com/q/ref/maps/#each-left-and-each-right