Skip to content(if available)orjump to list(if available)

Two Bites of Data Science in K

Two Bites of Data Science in K

10 comments

·January 26, 2025

RodgerTheGreat

I had a go at rewriting the latter half in Lil, flexing its K/Q heritage:

    t:readcsv[read["ICC Test Bowl 3003.csv"] "ssiiiiisffiiis"]

    sorted: select orderby Wkts desc orderby Ave asc where Wkts from t
    best: select where !gindex by Wkts from sorted

    bestInClass: select where each v i in Ave v~min (i+1) take Ave end from best

    allWkts: sorted.Wkts
    mostCompetitive: extract where (gindex=0)&15<count gindex by value from allWkts
    mostCompetitiveBowlers: select where Wkts in mostCompetitive from best

    gap: min allWkts drop 1+range max allWkts
"bestInClass" is probably the most awkward adaptation; I didn't see a tidy way to make a suffix list like ",\".

evertedsphere

is there a website or similar for this language? couldn't find anything with a quick google

mlochbaum

https://beyondloom.com/decker/lil.html

See also https://beyondloom.com/blog/rankingoffruits.html for a nice introduction to the query syntax and its relation to K. (And RodgerTheGreat is John Earnest, the author).

RodgerTheGreat

In addition to the resources others have linked, the main "entrypoint" page for Lil is here: http://beyondloom.com/tools/trylil.html

gitonthescene

The readme has links to various resources including tutorials: https://codeberg.org/ngn/k

gitonthescene

Oh, sorry. I misunderstood the question.

gitonthescene

I had a similar-ish project a while ago. I enjoy doing the "Spelling Bee" game in The NY Times Games section. In the comments someone worried that there weren't enough arrangements to keep the game going very long. I used an open source dictionary to generate all possible puzzles restricted by some basic heuristics like never using the letter S, having the total number of possible words in some reasonable range, etc. I found about 23,000 possible puzzles. My next idea was to use google's n-gram statistics to add some sort of "commonly known" heuristic, but my energy for the project petered out.

In any event these languages are great for exploring data in projects like these.

g939763

op, which version of k are you using in the post? for those who'd like to follow along

mlochbaum

ngn/k is mentioned, currently-maintained fork at https://codeberg.org/growler/k.

g939763

mentioned twice in fact, thank you