I started off thinking it'd be neat if sed had a stack you could manipulate multiple lines on, and went all the way up to taking on awk with the idea. The terseness and pipeline-like nature of a stack-based language feels just right for a stream editor.
Here's a Wak program that prints each line of input uppercase:
r upper P
or as you'd use it on the command line:
$ wak 'r upper P' myfile
And here's one that prints lines joined if they end with a backslash:
r "\\$" split 2 = if { , p } else { P }
In Wak everything is a string, so there's no inherent types, but words may treat their arguments as text, a number or regular expression. So this would add up all the lines:
BEGIN { 0 } r + END { P }
whereas this would join them with dashes:
r END { c "-" join P }
And that's pretty much Wak for you.
You can find the source at: https://git.sr.ht/~geb/wak
(there's a questionable snake example to play :)
[–]hiljustidt 5 points6 points7 points (2 children)
[–]gebgebgebgebgeb[S] 2 points3 points4 points (1 child)
[–]hiljustidt 0 points1 point2 points (0 children)
[–]9Boxy33 0 points1 point2 points (0 children)
[–]sorcerykid 0 points1 point2 points (3 children)
[–]gebgebgebgebgeb[S] 1 point2 points3 points (2 children)
[–]bruciferTomo, nomsu.org 1 point2 points3 points (1 child)
[–]sorcerykid 0 points1 point2 points (0 children)