KX Community

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

Home Forums kdb+ May I please know how the over iterator is being used here? Re: May I please know how the over iterator is being used here?

  • rocuinneagain

    Member
    May 24, 2023 at 12:00 am

    https://code.kx.com/q/ref/accumulators/#ternary-values

    You can use a sample to see how it progresses:

     

    ({-1 .Q.s1 `x`y`z!(x;y;z);x+y+z}/)[0;1 2 3;4 5 6] 
    `x`y`z!0 1 4 
    `x`y`z!5 2 5 
    `x`y`z!12 3 6 21

     

    And on the ssr example:

     

    ({-1 .Q.s1 `x`y`z!(x;y;z);ssr[x;y;z]}/)["results_%div_%dept.csv"; ("%div";"%dept"); ("banking";"m&a")] 
    `x`y`z!("results_%div_%dept.csv";"%div";"banking") 
    `x`y`z!("results_banking_%dept.csv";"%dept";"m&a") 
    "results_banking_m&a.csv"