KX Community

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

Home Forums kdb+ how does the query below work Re: how does the query below work

  • Laura

    Administrator
    April 21, 2022 at 12:00 am

    The dictionary Id!PrevID is a unary. Applying the Converge iterator to a unary f derives a function f/ (f Over). When you evaluate f/[x], the unary f gets applied successively until either (a) the result stops changing (convergence) or (b) the result matches x i.e. comes full circle.

    The white paper on iteration has some examples of iterating lists and dictionaries as finite-state machines.

    All this assumes your ID => previous ID paths actually terminate! (You can use the Converge iterator to start an open loop!)