free software resistance

 the cost of computing freedom is eternal vigilance

### arrlen.fig *original date:* jan 2017 *originally posted:* oct 2024 arrlen.fig: ``` #### arrlen prefixes length to each line of text #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ # x=$(echo hello | arrlen | awk '{print $1}') ; echo $x # 5 # $ for x in $(echo "hello there how are you?") ; do echo $x ; done | arrlen # 5 hello # 5 there # 3 how # 3 are # 4 you? # $ # create a function called delstr that deletes instances of delthis from string fromthis function delstr fromthis, delthis f = fromthis ; split f, delthis ; join f, "" ; return f fig # loop through whatever is piped (stdin) into arrlen... set each string to variable p forin p, stdin ## set cr to ascii 13, and set lf to ascii 10 cr = 13 ; chr lf = 10 ; chr z = p ; delstr z, cr ; delstr z, lf ## remove newlines from each string p = z ; len ; prints ; " " ; prints ## copy back to variable p, get length, put on screen p = z ; print ## copy again, put on screen next # stdin contains each line piped to arrlen. # forin copies each line of stdin to variable p, then runs other code until "next" is encountered. # then it goes to the next line of stdin and repeats the code in the "forin" loop. # except for block statements like forin and next, each line starts with a variable and each token can use that variable. # so this line: # p = z ; len ; prints ; " " ; prints # does the following: # * p = z (set p to contain the contents of variable z) # * len (change the string value of p to its own numeric length) # * prints (put the value of p on the screen, then stay on the same line) # * " " (change the value of p to one space, as a string) # * prints (put the value of p on the screen, stay on the line) # the difference between prints and print is that print goes to the next line afterwards ``` license: 0-clause bsd ``` # 2017 mn # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ``` => https://freesoftwareresistance.neocities.org