4 ms·
Beginnings of K interpreter written in OCaml
- murbard2 11y agoCool project! Was there a particular reason not to use ocamllex and menhir?
- RodgerTheGreat 11y agoAlways nice to see more open-source K implementations. Are array languages finally seeing some much-deserved attention?
- agumonkey 11y agoI just had an APL day last week. gnu-apl + emacs apl-mode was pretty fun. Array based thinking with repl like interaction.. gosh what a bliss.
- RodgerTheGreat 11y agoOnce you get past the initial learning curve, array algorithms are a wonderfully natural way to think about problem solving. The toolkit you get with APL or K is compact but capable of concisely solving a shocking range of problems. Most of the functional languages I've played with aren't half as effective, even with a much larger standard library.
- agumonkey 11y agoI dont' know, it feels APL is a brilliant but still 'DSL' compared to FP.
- beagle3 11y agoWhich domain would this DSL be specific to?
- agumonkey 11y agoAs in less general than recursive functions. But I admit it's a very subjective point.
- beagle3 11y agoPersonally, I feel the "recursion is the only way to iterate" purity is practically harmful, even though it is quite elegant for theory. K/J/Q/APL2 and friends[0] have isolated iterative constructs that cover IME 98% of what's needed (each, fold, scan, fixed point, ...) in a way that's just as simple to analyze as recursion[1]. These languages do like DSLish for the first 10 or 20 examples you see - but by the 200th example, it is clear the domain it is specific to is "mostly everything" [0] I'm not considering APL1 as part of the modern family - it had Fortran-style computed gotos for control flow. [1] Although there's about 10 times as many of them, so it's not quite as elegant.
- aplorbust 11y agoI use k/q to read HN, sort of like RSS. I'm a kdb+ novice but am determined to master it someday. This is a way for me to keep using k/q every day and build familiarity.
- RodgerTheGreat 11y agoThere's also Kona[1], which targets K3 and my own interpreter called oK[2], which targets K5. Good hunting! [1] https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona [2] https://github.com/JohnEarnest/ok https://github.com/JohnEarnest/ok
- LeonidasXIV 11y agoWhat are the differences between K and J? The latter has a complete free software implementation.
- RodgerTheGreat 11y agoShort version: K is a tight, fast exercise in minimalism. It takes after Scheme a bit more than most other APLs. Good at dealing with "ragged" and mixed-type data. J is a larger language with more "batteries included". It keeps the traditional APL emphasis on uniform, rectangular data and has a number of advanced features.