KX Community

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

Home Forums kdb+ Apply a list of parameters to a list of input Re: Apply a list of parameters to a list of input

  • cillianreilly

    Member
    June 8, 2023 at 12:00 am

    The lambda isn’t necessary here:

     

    q)update m:price@'n from tab 
    time        | price n m 
    ------------| --------------------------------- 
    10:03:54.347| 20.83 21.44 26.83 29.83 0 20.83e 
    10:04:05.827| 88.88 88.75 83.27 823.77 1 88.75

     

    Not useful for the general case, but here you can forgo the explicit n column and use the virtual index column instead:

     

    q)tab:([time:10:03:54.347 10:04:05.827]price:(20.83 21.44 26.83 29.83e;88.88 88.75 83.27 823.77f)) 
    q)update m:price@'i from tab 
    time        | price m 
    ------------| ------------------------------- 
    10:03:54.347| 20.83 21.44 26.83 29.83 20.83e 
    10:04:05.827| 88.88 88.75 83.27 823.77 88.75