Search code examples
kdb

Cleanest way of joining a dictionary to a string?


Let's say I have

k: `a`b`c
v: 1 2 3

How can we make a string of the form:

a=1&b=2&c=3

Solution

  • The following lambda accomplishes what you want (accepting a dictionary as its argument):

    {"&" sv "=" sv/: string flip (key;value)@\:x} `a`b`c!1 2 3