KX Community

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

Home Forums kdb+ Challenge 1 – Triangle Font Re: Challenge 1 – Triangle Font

  • jfealy

    Member
    February 2, 2023 at 12:00 am

    Another alternative

    q)ts:10000 {x#'x} 1+til 100 
    207 63616 
    q)ts:10000 {sums[-1_t]_where t:til 1+x}100 
    106 130112 
    q){x#'x}[1+til 100]~{sums[-1_t]_where t:til 1+x}100 
    1b

    However, when applied to a large vector, performance drops off as cut is expensive

    q)ts {x#'x} 1+til 50000 
    4099 14763251840 
    q)ts {sums[-1_t]_where t:til 1+x}50000 
    6454 31943645248