Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
| vs:0:"valid_solutions.txt" | |
| vg:0:"valid_guesses.txt" | |
| ch:{e-^(,/(=x@>e)@'<'=y)?<>e:x=y} /check::guess->solution->list (-1 b, 0 y, 1 g) | |
| en:{-+/`ln[d]*'d:f%+/f:#'=x} /entropy::list->number | |
| bg:{x@*>en'x ch/:\:y} /best_guess::guesses->solutions->string | |
| ma:{[g;s;r]s@&r~/:g ch/:s} /matches::guess->solutions->response->string list | |
| pl0:{ /solver that always guesses valid solutions | |
| s:"raise" |
Code examples are in ngn/k, a dialect where int null is 0N and a list find miss is 0N, not #list.
It would be nice if a grouped list gave empty int list for an outdex, and outdex of frequency gave zero. (See here for more.)
x:="abracadabra"
I'm sorry to tell you, but group is gone.
If you check out the latest k.d on shakti.com as at 28 March 2023, you'll see that 'unary' = is now 'freq' (frequency).
Group had a long life: it's been around since at least k2, or 1996.
So why did group go? And what should we use instead?
| Syntax | Name | Description | Example | Output | |
|---|---|---|---|---|---|
| +/x | Sum | Sum all value in x | +/1 2 3 4 5 | 15 | |
| -':x | Deltas | Pairwise differences in x | -':1 2 3 4 | 1 1 1 1 | |
| |+x | Rotate matrix | Rotate x counterclockwise | |+3 3#!9 | (2 5 8;1 4 7;0 3 6) | |
| x@<x | Sort | Sort x | {x@<x}@8 3 7 1 | 1 3 7 8 | |
| ?x,y | Set union | Unique elements from x and y | ?"abac","adob" | "abcdo" | |
| x^x^y | Intersection | Common elements from x and y | {?x^x^y}["abac";"adob"] | "aba" | |
| x|-x | Absolute value | Absolute value of x | {x|-x}@-1 | 1 | |
| */y#x | Power | x in power of y (y>0) | {*/y#x}[2;5] | 32 | |
| y@(#y)!x+!#y | Rotate left | Rotate y by x elements to the left | {y@(#y)!x+!#y}[3;"abcde"] | "deabc" |
| / ngn/k | |
| \d http | |
| s:{$[`C=@x;x;$x]} / string | |
| qs:{"'",(s x),"'"} / quote string | |
| cp:{$[1~#p:$x;"-",p;"--",p]} / command param | |
| c:{" "," "/(cp'!x),'" ",'qs'.x} / cp list | |
| q:{"?","&"/($!x),'"=",'s'.x}. / dict -> qstring | |
| gr:{."\\curl -Gs ",qs x} / GET raw | |
| g:{gr x,(q y)} / GET[url;qs] |
We use #user/uri rather than unquaified #uri per Alex Miller comment in the Ask Clojure thread.
License: public domain
John Belmonte, 2022-Sep
In the previous installment, we introduced some basics of structured concurrency, and considered how this paradigm might fit within the Lua programming language.
An important point was encapsulation: the caller of a function shouldn't be concerned whether the implementation employs concurrency or not. We shouldn't have to give up features of the language or runtime just because our program contains concurrency.
A primary example is exception handling. In a basic Lua program without concurrency, we have the following expectations about error propagation:
This article is a response to mfiano’s From Common Lisp to Julia which might also convey some developments happening in Common Lisp. I do not intend to suggest that someone coming from a Matlab, R, or Python background should pickup Common Lisp. Julia is a reasonably good language when compared to what it intends to replace. You should pickup Common Lisp only if you are interested in programming in general, not limited to scientific computing, and envision yourself writing code for the rest of your life. It will expand your mind to what is possible, and that goes beyond the macro system. Along the same lines though, you should also pickup C, Haskell, Forth, and perhaps a few other languages that have some noteworthy things to teach, and that I too have been to lazy to learn.
/I also do not intend to offend anyone. I’m okay with criticizing Common Lisp (I myself have done it below!), but I want t