KX Community

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

Home Forums kdb+ abs() vs abs[] for fby “while” all() vs all[] Reply To: abs() vs abs[] for fby “while” all() vs all[]

  • rocuinneagain

    Member
    May 20, 2024 at 8:45 am

    <div>See these sections of docs on:</div>

    Order of evaluation also matters: Left-of-Right Evaluation

    abs(price)=({abs max x};price)

    Will run in order:

    1. ({abs max x};price)
    2. (price)=({abs max x};price)
    3. abs(price)=({abs max x};price)

    whereas:

    abs[price]=({abs max x};price)

    Will run in order:

    1. ({abs max x};price)
    2. abs[price]
    3. abs[price]=({abs max x};price)

    This tries to pass 2 arguments to all which only takes one argument so you get a rank error

    https://code.kx.com/q/ref/all-any/#all

    all[col=a;col2=b]