Programming in K

2026-02-2611:276712github.com

An open-source interpreter for the K5 programming language. - JohnEarnest/ok

You can’t perform that action at this time.


Read the original article

Comments

  • By chrisaycock 2026-03-0122:363 reply

    I first encountered q/kdb+ at a quant job in 2007. I learned so much from the array semantics about how to concisely represent time-series logic that I can't imagine ever using a scalar language for research.

    Fun fact: the aj (asof join) function was my inspiration for pandas.merge_asof. I added the extra parameters (direction, tolerance, allow_exact_matches) because of the limitations I kept hitting in kdb.

    https://code.kx.com/q/ref/aj/

    https://pandas.pydata.org/docs/reference/api/pandas.merge_as...

    • By zX41ZdbW 2026-03-0123:03

      Similarly, this is how it was introduced in ClickHouse in 2019: https://github.com/ClickHouse/ClickHouse/pull/4774

    • By leprechaun1066 2026-03-020:071 reply

      The aj function at its heart is a bin (https://code.kx.com/q/ref/bin/) search between the two tables, on the requested columns, to find the indices of the right table to zip onto the left table.

        aj[`sym`time;t;q]
      
      becomes

        t,'(`sym`time _q)(`sym`time#q)bin`sym`time#t
      
      The rest of the aj function internals are there to handle edge cases, handling missing columns and options for filling nulls.

      A lot of the joins can be distilled to the core operators/functions in a similar manner. For example the plus-join is

        x+0i^y(cols key y)#x

    • By sceadu 2026-03-0221:58

      dang I had no idea you wrote the asof join for pandas. thank you for that

  • By koolala 2026-03-020:101 reply

    I wish there was a language like K that worked with single precision floats. Would be great to use with graphics.

    • By ksherlock 2026-03-020:471 reply

      q is like k and has single precision floats.

      • By koolala 2026-03-021:56

        q is closed source so it isn't really viable to build anything out of it unfortunately. I wonder how they made floats work since it is based on k.

  • By jjtheblunt 2026-03-020:451 reply

    the github repo linked, under "manual.md", has a link which redirects to malware, such as that ostensibly to "k6".

HackerNews