Ngn/k (free K implementation)

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • kona

    Open-source implementation of the K programming language

  • ngn-k-tutorial

    An ngn/k tutorial.

    It was just an honest question. I've just peeked at APL, J and K due to posts here on HN, and the sample code I've seen mostly reads as noise to me, so I was just curious if there were any array languages that would be approachable to me.

    The tutorial does help a fair bit, though glossing through it, it doesn't really explain why it has to be so exceptionally terse.

    I mean the matmul[1] sure is impressively short in the end, and with a background in computer graphics and simulations I can absolutely appreciate working on arrays rather than singular values. But I'm sure one could get the same computational result with a bit more approachable syntax.

    [1]: https://github.com/razetime/ngn-k-tutorial/blob/main/c-think...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • kdb

    kdb+ Working Group from FINOS Data Technologies program (by finos)

    > let's say I have a finance team that have never heard of it - why might they be interested?

    In my experience it's very good at quickly developing real-time analytics applications with only a small set of developers. A couple of q developers can develop, maintain and operate the server side of 5 or 6 separate applications without breaking a sweat. Changes come in at a high speed too.

    It's a highly interactive language. A bit like a lisp, you start up a q process, open a port and then you iterate and update your application live without needing to restart. Typically on our projects we've had a well iterated program running in QA for a day or 2 before opening a PR (which becomes more of a formality for getting the solution to the problem into prod at that stage).

    The q language itself is quite wordy. Check the reference page: https://code.kx.com/q/ref/ Many programs written in q consist mainly of the key words with the special operators interspersed. Also see some example libraries: https://github.com/finos/kdb

    It's been a fairly stable language to work with, having few breaking changes between successive versions. q code written 8/9/10 years ago on older versions will most likely still run the same today. We have source code on one project at work which hasn't had a code change in 6 years now (despite moving through different versions 2.8->3.0->3.3->3.5->4.0) and it runs daily without a hiccup.

    Mostly it's a joy working with it because I feel like I get to tell the computer what I want it to do, without also having to tell it how to do it.

  • array

    Simple array language written in kotlin (by lokedhs)

    In some of the example programs written in KAP (my APL derivative), I tried to write it in a style that makes people unfamiliar with the array style more comfortable.

    This code could of course have been written in a style similar to some of the more extreme examples, and they would have been significantly shorter in that case.

    https://github.com/lokedhs/array/blob/master/demo/advent-of-...

  • kerf1

    Kerf (Kerf1) is a columnar tick database and time-series language for Linux/OSX/BSD/iOS/Android. It is written in C and natively speaks JSON and SQL. Kerf can be used for trading platforms, feedhandlers, low-latency networking, high-volume analysis of realtime and historical data, logfile processing, and more.

    The author of Kona has written kerf which I believe is intended for this same space. I’ve never used it though. https://github.com/kevinlawler/kerf1

  • ok

    An open-source interpreter for the K5 programming language. (by JohnEarnest)

    In case you've jumped straight to the comments, here are some 'intro' links. Many of these also appear in ngn/k's readme.

    First, direct links to ngn/k in the browser:

    - REPL: https://ngn.bitbucket.io/k/#r

    - editor: https://ngn.bitbucket.io/k/

    Second, the best one-stop shop for an overview of k6's primitives (both ngn/k and oK are based on k6). https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual....

    The best k intro examples are in John Earnest's k editor iKe - there's a dropdown at the bottom right. http://johnearnest.github.io/ok/ike/ike.html

    ngn/k's editor also has an 'examples' dropdown in its menu.

    Next, some Advent of Code solutions, to show that k doesn't have to look like a mass of meaningless symbols: https://github.com/chrispsn/aoc2017/blob/main/answers.k

    For an illustration of k's strengths,

  • aoc2017

    ngn/k (by chrispsn)

    In case you've jumped straight to the comments, here are some 'intro' links. Many of these also appear in ngn/k's readme.

    First, direct links to ngn/k in the browser:

    - REPL: https://ngn.bitbucket.io/k/#r

    - editor: https://ngn.bitbucket.io/k/

    Second, the best one-stop shop for an overview of k6's primitives (both ngn/k and oK are based on k6). https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual....

    The best k intro examples are in John Earnest's k editor iKe - there's a dropdown at the bottom right. http://johnearnest.github.io/ok/ike/ike.html

    ngn/k's editor also has an 'examples' dropdown in its menu.

    Next, some Advent of Code solutions, to show that k doesn't have to look like a mass of meaningless symbols: https://github.com/chrispsn/aoc2017/blob/main/answers.k

    For an illustration of k's strengths,

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • bqn-libs

    Informal collection of BQN utilities

    Languages with multidimensional arrays (APL, BQN, J, but not K) have trouble with dicts because an index into an array is a list of numbers, and an index into a dict is an arbitrary value. Many primitives, and especially selection, are designed around lists of numbers and don't transfer to dicts. In K, where the index into a list is one number, there's still a requirement that the keys in a dict all have the same level of nesting, but this isn't bad in practice. BQN will eventually have hashmaps implemented as in a more mainstream/conventional way, as objects. There's a model at https://github.com/mlochbaum/bqn-libs/blob/master/hashmap.bq... .

    I don't think studying the compiler is a very good way to learn BQN, but I would like to write up parts of it (limited by time and motivation of course). I did some chat sessions on this sort of compilation during early development; see the links at the bottom of https://mlochbaum.github.io/BQN/implementation/ .

  • PDP_11_Simulator

    PDP11 Simulator written in APL

    I can offer you the contrary opinion: why I would not use these kind of languages.

    A couple of years ago I worked on a non-trivial APL application with one of my university professors and another student. We were trying to build a CPU simulator flexible enough to handle stuff ranging from PDP-11 up to Intel x86. The goal was to run some analysis on memory accesses performed by the x86 architecture. Quite an interesting project in which I worked on for around two year.

    The code is still available if you're interested: https://github.com/emlautarom1/PDP_11_Simulator

    The first implementation was done in APL using a book which I don't remember as reference. We had a couple of meetings where we learned APL and the general idea behind the design. Pretty soon we started to deal with a lot of issues like:

    - We only found two implementations for the APL interpreter: GNU and Dyalog. GNU is free but pretty much abandoned. Support for Windows was (is?) nonexistent. Dyalogs version is proprietary so we couldn't use that (even when a "student" version was available).

  • pdp11.jl

    PDP-11 Simulator written in Julia

    - No debugging at all. You run the code and pray for the best.

    A year after we started my classmate decided to drop the project since he felt he couldn't keep up with the complexity: each line of code was non-trivial and really hard to understand.

    Eventually we had to rewrite the whole project because GNUs interpreter didn't support big integers, and trying to circumvent that resulted in very poor performance. The new version was written in Julia (https://github.com/emlautarom1/Julia_Simulator), so we were able to reuse a lot of "array code". The project got cancelled in the middle of the rewrite and we kind of forgot about it.

  • april

    The APL programming language (a subset thereof) compiling to Common Lisp.

    This might have been true a couple of years ago but it is totally untrue now.

    I'm not sure why you couldn't use the student version of Dyalog? Sounds like it would have been fine. There are also many more FOSS implementations of array languages now, such as ngn/k and April. https://github.com/phantomics/april

    'only available for Linux' - not true https://github.com/abrudz/Kbd/ and others (also different input modes like `w for ⍵)

    'no community support' - on the contrary there is a big and helpful APL community https://aplwiki.com/wiki/Chat_rooms_and_forums that is (imo) more useful than stackoverflow

    'Dynamic scoping...' - Dyalog's (and other APL's) dfns have lexical scope.

    'The language is extremely terse' - is this meant to be a bad thing?

    'The code tends to be very hacky' - maybe if you write bad code or try and write C in APL (it won't work)

  • Kbd

    Alternative unified APL keyboard layouts (AltGr, Backtick, Compositions) (by abrudz)

    This might have been true a couple of years ago but it is totally untrue now.

    I'm not sure why you couldn't use the student version of Dyalog? Sounds like it would have been fine. There are also many more FOSS implementations of array languages now, such as ngn/k and April. https://github.com/phantomics/april

    'only available for Linux' - not true https://github.com/abrudz/Kbd/ and others (also different input modes like `w for ⍵)

    'no community support' - on the contrary there is a big and helpful APL community https://aplwiki.com/wiki/Chat_rooms_and_forums that is (imo) more useful than stackoverflow

    'Dynamic scoping...' - Dyalog's (and other APL's) dfns have lexical scope.

    'The language is extremely terse' - is this meant to be a bad thing?

    'The code tends to be very hacky' - maybe if you write bad code or try and write C in APL (it won't work)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts