Emacs tip of the day: M-: evaluates elisp snippets, but C-u M-: inserts the result into the current buffer. Really handy for quick scripts.
miniblog.
Related Posts
Writing a REPL that evaluates-as-you-type, keeping the UI responsive and staying defensive against runaway memory usage: https://scattered-thoughts.net/writing/making-live-repls-behave/
It's a really hard problem for PLs, but even this small live demo has a lot of complexity.
The efficiency of wasm is really impressive. An optimised build of Stockfish with POPCNT evaluates positions at ~1500kn/s on a single core of machine. By contrast, the wasm build on https://lichess.org/analysis/r4rk1/p5b1/2p2n2/1p2p3/4P2q/P1N1B3/1PP1B1Q1/2KR3n_w#0 can compute ~42kn/s in the browser for the same position!
Emacs tip: if something evaluates to a number, Emacs shows all possible interpretations of it e.g. 97 (#o141, #x61, ?a) (octal, hex, ASCII)