free software resistance

 the cost of computing freedom is eternal vigilance

### figfr *original date:* nov 2017 *originally posted:* oct 2024 figfr: ``` z2.fig ***** z = "heya" ; arr z = plus "hello" z = plus "ok" z = plus "thats nice" z ; print forin (l, z) p = l ; ucase().left(2).print() #### all commands parse left to right next r.fig ***** p "hello" reverse print 10.fig ***** p=10 : chr : prints p=10 | chr | prints p=10; chr().prints(); e.fig ***** p "hey there" left 1 string p 5 print allfig.fig ***** q 34 chr b 92 chr p "find / | grep " plus q plus b plus ".fig" plus q plus " | cat -n" arrshell forin x p z x print nextin hello.fig ***** forin x "hello!" z x print nextin edarr.fig ***** ed arr plus 5 ed plus 7 ed print ed arropen "edarr.fig" print crtolf.fig ***** forin p stdin ch10 10 chr ch13 13 chr z p split z ch13 join z ch10 rstrip prints next fr.fig ***** p "hello there how are you" split p " " forin x p z x print next p "" print end #debug info in divby removed (sorry, wasnt intended) #backwards loops working for first time (they went backwards, but now they go back to the number specified) #arrfor implemented (yay!) #ifequal: p 1 plus 4 z 5 plus 0 ifequal p z pass else zz "no" print fig for x 1 100 1 p x prints p 32 chr prints nextin p "" print for x 100 1 -1 p x prints p 32 chr prints nextin p "" print p "a" arr plus "b" plus "c" z 1 arr plus 2 plus 3 forin x p forin xx z zz x prints get xx prints 32 chr prints nextin p " " print nextin for4.fig ***** for n 0 6 1 ## in basic: for n = 0 to 6 step 1 z n prints " " prints next dt.fig ***** z "waiting 5 seconds..." print sleep 5 z "the date is: " prints date print z "there are: " prints timer prints " seconds elapsed since 12:00:00 am" print z "the time is: " prints time print h.fig ***** # #hello forin p "hello" # hello ifmore 4 7 # ok z p print # hey there fig next hw.fig ***** # fig m = "hello, world!" ; print ; right(12) forin x, m z = x ; print next e.fig ***** p "hey there" left 1 string 5 p print 100.fig ***** p arrset 1 1 p=10 : chr : prints p=10 | chr | prints p=10; chr().prints(); 12.fig ***** z sleep 10 date.fig ***** fw "/tmp/tes2" open "w" #arropen("/tmp/tes") p p date print p arrstdin print forin x p #stdin z x prints z x fprint "/tmp/tes2" nextin p "/tmp/tes2" close end p "hello there" split p " " arreverse print p "hello there" split p " " reverse print p "hello there" reverse print ge.fig ***** x arr x arrset 1 "hi" z arrget x 1 print meh.fig ***** x = "hello, world" : left(2) : plus("y") : ucase : print fe.fig ***** fl "find . -type f | egrep -v '^\/sys\/|^\/dev\/|^\/proc\/'" arrshell function ext f p f reverse instr p "." fp f lcase right 7 ifequal fp ".fig.py" z f right 7 else ifmore p 0 z f right p else z f fig fig p z reverse instr p "/" minus 1 ifmore p 0 f z right p else f z fig p return f fig #p fl len print forin f, fl: z ext f print next inc.fig ***** n #### set n to 0 while z n plus 1 swap z n "n is equal to: " prints z n prints sleep 1 " ...hit ctrl-c to break" print wend date.fig ***** p p date print #p arrstdin print #forin p stdin #z p rtrim print #nextin p "hello there" split p " " arreverse print p "hello there" split p " " reverse print p "hello there" reverse print db.fig ***** p p print zp.fig ***** z "heya" arr z plus "hello" z plus "ok" z plus "thats nice" z print forin l z p l print next funcs.fig ***** function cheese x z get x minus 1 for r 0 z 1 p r print next fig z cheese 5 funcp.fig ***** function hello sub p "hey" left 1 print #z return 5 fig z 9 hello sub print once.fig ***** function re(z p) f=z ; split(f p) ; join(f "") ; return(f) fig l ; arr forin (p stdin) cr=13 ; chr lf=10 ; chr z=p ; re(z cr) ; re(z lf) inl instr l z iftrue inl pass else p=z ; print l plus z fig next 20f.fig ***** function p q a z w s x e d c r f v t g b y h n u i o m get q print m get a print m get z print z get w print z get s print z get x print z get e print z get d print z get c print z get r print z get f print z get v print z get t print z get g print z get b print z get y print z get h print z get n print z get u print z get i print z get o print fig z p 5 4 3 7 6 5 3 3 3 "a" "z" "r" 8 9 0 1 2 3 7 8 9 ascii.fig ***** for p 0 255 1 z p chr prints next callsub.fig ***** function printupper sub z "upper!" print fig setthisvar printupper sub # call the sub fb.fig ***** #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ for fb 1 100 1 while ck5 fb mod 5 not ck3 fb mod 3 not iftrue ck5 iftrue ck3 now "fizzbuzz" print break fig fig iftrue ck5 now "buzz" print break fig iftrue ck3 now "fizz" print break fig now fb print break wend next int.fig ***** x "5.7" val print int print x "5.0" val print figsub.fig ***** sub 7 print sub "hi" print function sub p "um" print fig p sub da.fig ***** x 7 y y 8 str z x str plus y print arrstr.fig ***** z : arr : print : time print # set z, make it an array, print, now string z : arr : print : len print # set z, make an array, print, now numeric zr.fig ***** z 2 print z 5 print pete.fig ***** function x (y z) #### parentheses, colons and = are not required p = y # this works p = z # this works p = "this will act like a sub" : print fig z = 8 : x (5, "pete") # the only required syntax here is the # to comment # value of z wont be changed by calling x p = z : print function x (y z) #### parentheses, colons and = are not required p = y # this works p = z # this works p = "this will act like a function" : print : RETURN Y # not case-sensitive fig z = x("pete", "ian") p = z: print count.fig ***** p 0 #z p plus 1 #p z print #z p plus 1 #p z print #z p plus 1 #p z print z p plus 1 swap z p print z p plus 1 swap z p print z p plus 1 swap z p print st.fig ***** x arropen "/dev/stdin" forin p x z p ucase print nextin zp.fig ***** z "heya" arr z plus "hello" z plus "ok" z plus "thats nice" z print forin l z p l ucase left 2 print next d.fig ***** cheese 2 plus 3 times 14 print age cheese print times -1 print variable 2 plus 3 times 14 sqr print vvv.fig ***** p 5 arr p print function x p print fig p print z x p print t.fig ***** while x "ls -l loop.mp3" shell sleep 2 wend fig.fig ***** x : "hello there" : len : str : plus "2358 " z : x : times 3 : print ## in python: z = x ; z = z * 3 ; print z stu.fig ***** X ARROPEN "/dev/stdin" FORIN P X Z P UCASE PRINT NEXTIN for.fig ***** #basic style for x = 1, 5, 1 z = "hello" : left(2) : plus "y" : ucase : print next #python style for x (1, 5, 1) z = "hello" ; left(2).plus("y").ucase().print() next #bash style for x (1 5 1) z="hello"; left 2 | plus "y" | ucase | print next ct.fig ***** p arr times 10 for countthis 1 10 1 z countthis str p arrset countthis z fig forin countthat p z "[This is string #" prints z countthat prints z "]" print fig command.fig ***** function commandstring python from sys import argv return " ".join(argv) fig fig z commandstring print # like command$ string.fig ***** p string 104 27 print z string 2 "55" print pete2.fig ***** function x y z p y p z p "this will act like a sub" print fig z 8 x 5 "pete" p z print function x y z p y p z p "this will act like a function" print RETURN Y fig z x "pete" "ian" p z print 101.fig ***** p arr arrset 1 1 p=10 : chr : prints p=10 | chr | prints p=10; chr().prints(); center.fig ***** width = 40 ## public domain ## text = "keep calm and System.out.printlin ('Hello World')" quot = 34 chr txt = split text "'" join txt quot split txt " " ## center each ## forin p txt half = p len times -1 plus width divby 2 int sp = " " times half prints now = p print next ins.fig ***** x : "hey" : instr x "e" print ef.fig ***** p string 104 27 print nstr.fig ***** # #public domain z : "ls" : arrshell forin p z ck : instr p ".fig" iftrue ck x : p : print fig nextin ef.fig ***** p string "h" 104 print defdef.fig ***** function hello p z p times 8 return z fig function heya f z "ok" print len hello f print times 5 return z fig z 7 heya z print ks.fig ***** p "hello there are words here" z p ucase # prints z split p " " # print forin skippy z thatsfine skippy print nextin jac.fig ***** FOR I = 1 10 1 Z = I PRINT NEXT Z = "I'M DONE" PRINT swap.fig ***** pink = 5 pin = "100" z = pink print swap z, pin : print : int : times 7 : print topwr.fig ***** x 5 topwr 2 print sub.fig ***** function hello sub z "well hey " prints z return "there" fig p "ok" hello sub print fig.fig ***** p arropen "../br.fig" #f "figt.txt" open "w" forin x p z x print #f next rc.fig ***** A = "HEY" : ARR : PLUS "HELLO WORLD" PLUS "GREETS" N = INSTR ( A, "HEY" ) STR P = "[" PLUS N PLUS "]" PRINT func.fig ***** p "hello" len python p = 1 / 3.0 + (p * (3 + 7 * 9) ** 5.7) fig z p print for.fig ***** for x (1, 5, 1) z = x : print() next wc.fig ***** ti "hello there how are you" split ti " " # split ti into words separated by " " forin p ti z p prints " has " prints z p len prints " characters." print next # fig also works here xp.fig ***** x print cd.fig ***** try p "/tmp/tmp" chdir except pass fig while z "hello" print sleep 2 wend v.fig ***** p 5 arr print #### create array #### define function function x p p print p arrset 1 "hello" fig #### print variable p p print #### call function z x p p print #### note: arrays work differently in scope to other variables. if passed, global mutable. #### to get value of a function parameter, use [b]get[/b]. #### to return non-array value, use [b]return[/b] (exits function.) left.fig ***** p "hello there" left 20 print pp "*" plus p plus "*" print lf.fig ***** p 120 str print function p z p get z times 5 return p fig z p 2 print p "20" val print eq.fig ***** p = "hello" x == "hey" a = "yes" : arr ifequal "hello" == p a : print fig ifequal "hey" = x a : print fig ifequal p == x pass else n == "no" : print fig mrk.fig ***** p 50 print p "hello" print p 5 arr plus 7 plus 12 print # array of [5, 7, 12] function p z return 7 fig x p print # prints 7 p 256 print # and is a numeric again ff.fig ***** function : hi : wd x : get wd z : x : print fig p hi 7 p hi 7 x : arr : arrset 1 "hi" print p plus 7 p print x plus 7 print x plus 7 join x "" z x print pal.fig ***** #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ function ckp ckfp ck get ckfp lcase b "" ## leave only alpha forin l ck forin a "abcdefghijklmnopqrstuvwxyz" ifequal l a z b plus l swap z b fig next next z b print d "" forin p b z p plus d swap z d next ifequal b d z ck print "is a palindrome" print 32 chr print else z ck print "is not a palindrome" print 32 chr print fig fig p ckp "do nine men INTERPRET? nine men, i nod!" func2.fig ***** st 7 function printasterisked st # no longer needed: z get st swap z gt z "*" plus st plus "*" print fig ppp "hello" printasterisked ppp ok st print lft.fig ***** x "hello" left 2 z2.fig ***** z = "heya" ; arr z = plus "hello" z = plus "ok" z = plus "thats nice" z ; print forin (l, z) p = l ; ucase().left(2).print() #### all commands parse left to right next r.fig ***** p "hello" reverse print e.fig ***** p "hey there" left 1 string p 5 print allfig.fig ***** q 34 chr b 92 chr p "find / | grep " plus q plus b plus ".fig" plus q plus " | cat -n" arrshell forin x p z x print nextin hello.fig ***** forin x "hello!" z x print nextin edarr.fig ***** ed arr plus 5 ed plus 7 ed print ed arropen "edarr.fig" print crtolf.fig ***** forin p stdin ch10 10 chr ch13 13 chr z p split z ch13 join z ch10 rstrip prints next fr.fig ***** p "hello there how are you" split p " " forin x p z x print next p "" print end #debug info in divby removed (sorry, wasnt intended) #backwards loops working for first time (they went backwards, but now they go back to the number specified) #arrfor implemented (yay!) #ifequal: p 1 plus 4 z 5 plus 0 ifequal p z pass else zz "no" print fig for x 1 100 1 p x prints p 32 chr prints nextin p "" print for x 100 1 -1 p x prints p 32 chr prints nextin p "" print p "a" arr plus "b" plus "c" z 1 arr plus 2 plus 3 forin x p forin xx z zz x prints get xx prints 32 chr prints nextin p " " print nextin for4.fig ***** for n 0 6 1 ## in basic: for n = 0 to 6 step 1 z n prints " " prints next dt.fig ***** z "waiting 5 seconds..." print sleep 5 z "the date is: " prints date print z "there are: " prints timer prints " seconds elapsed since 12:00:00 am" print z "the time is: " prints time print h.fig ***** # #hello forin p "hello" # hello ifmore 4 7 # ok z p print # hey there fig next hw.fig ***** # fig m = "hello, world!" ; print ; right(12) forin x, m z = x ; print next e.fig ***** p "hey there" left 1 string 5 p print 110.fig ***** p arrset 1 1 p=10 : chr : prints p=10 | chr | prints p=10; chr().prints(); 12.fig ***** z sleep 10 date.fig ***** fw "/tmp/tes2" open "w" #arropen("/tmp/tes") p p date print p arrstdin print forin x p #stdin z x prints z x fprint "/tmp/tes2" nextin p "/tmp/tes2" close end p "hello there" split p " " arreverse print p "hello there" split p " " reverse print p "hello there" reverse print ge.fig ***** x arr x arrset 1 "hi" z arrget x 1 print meh.fig ***** x = "hello, world" : left(2) : plus("y") : ucase : print fe.fig ***** fl "find . -type f | egrep -v '^\/sys\/|^\/dev\/|^\/proc\/'" arrshell function ext f p f reverse instr p "." fp f lcase right 7 ifequal fp ".fig.py" z f right 7 else ifmore p 0 z f right p else z f fig fig p z reverse instr p "/" minus 1 ifmore p 0 f z right p else f z fig p return f fig #p fl len print forin f, fl: z ext f print next inc.fig ***** n #### set n to 0 while z n plus 1 swap z n "n is equal to: " prints z n prints sleep 1 " ...hit ctrl-c to break" print wend date.fig ***** p p date print #p arrstdin print #forin p stdin #z p rtrim print #nextin p "hello there" split p " " arreverse print p "hello there" split p " " reverse print p "hello there" reverse print db.fig ***** p p print zp.fig ***** z "heya" arr z plus "hello" z plus "ok" z plus "thats nice" z print forin l z p l print next funcs.fig ***** function cheese x z get x minus 1 for r 0 z 1 p r print next fig z cheese 5 funcp.fig ***** function hello sub p "hey" left 1 print #z return 5 fig z 9 hello sub print once.fig ***** function re(z p) f=z ; split(f p) ; join(f "") ; return(f) fig l ; arr forin (p stdin) cr=13 ; chr lf=10 ; chr z=p ; re(z cr) ; re(z lf) inl instr l z iftrue inl pass else p=z ; print l plus z fig next 20f.fig ***** function p q a z w s x e d c r f v t g b y h n u i o m get q print m get a print m get z print z get w print z get s print z get x print z get e print z get d print z get c print z get r print z get f print z get v print z get t print z get g print z get b print z get y print z get h print z get n print z get u print z get i print z get o print fig z p 5 4 3 7 6 5 3 3 3 "a" "z" "r" 8 9 0 1 2 3 7 8 9 ascii.fig ***** for p 0 255 1 z p chr prints next callsub.fig ***** function printupper sub z "upper!" print fig setthisvar printupper sub # call the sub fb.fig ***** #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ for fb 1 100 1 while ck5 fb mod 5 not ck3 fb mod 3 not iftrue ck5 iftrue ck3 now "fizzbuzz" print break fig fig iftrue ck5 now "buzz" print break fig iftrue ck3 now "fizz" print break fig now fb print break wend next int.fig ***** x "5.7" val print int print x "5.0" val print figsub.fig ***** sub 7 print sub "hi" print function sub p "um" print fig p sub da.fig ***** x 7 y y 8 str z x str plus y print arrstr.fig ***** z : arr : print : time print # set z, make it an array, print, now string z : arr : print : len print # set z, make an array, print, now numeric zr.fig ***** z 2 print z 5 print pete.fig ***** function x (y z) #### parentheses, colons and = are not required p = y # this works p = z # this works p = "this will act like a sub" : print fig z = 8 : x (5, "pete") # the only required syntax here is the # to comment # value of z wont be changed by calling x p = z : print function x (y z) #### parentheses, colons and = are not required p = y # this works p = z # this works p = "this will act like a function" : print : RETURN Y # not case-sensitive fig z = x("pete", "ian") p = z: print count.fig ***** p 0 #z p plus 1 #p z print #z p plus 1 #p z print #z p plus 1 #p z print z p plus 1 swap z p print z p plus 1 swap z p print z p plus 1 swap z p print st.fig ***** x arropen "/dev/stdin" forin p x z p ucase print nextin zp.fig ***** z "heya" arr z plus "hello" z plus "ok" z plus "thats nice" z print forin l z p l ucase left 2 print next d.fig ***** cheese 2 plus 3 times 14 print age cheese print times -1 print variable 2 plus 3 times 14 sqr print vvv.fig ***** p 5 arr p print function x p print fig p print z x p print t.fig ***** while x "ls -l loop.mp3" shell sleep 2 wend fig.fig ***** x : "hello there" : len : str : plus "2358 " z : x : times 3 : print ## in python: z = x ; z = z * 3 ; print z stu.fig ***** X ARROPEN "/dev/stdin" FORIN P X Z P UCASE PRINT NEXTIN for.fig ***** #basic style for x = 1, 5, 1 z = "hello" : left(2) : plus "y" : ucase : print next #python style for x (1, 5, 1) z = "hello" ; left(2).plus("y").ucase().print() next #bash style for x (1 5 1) z="hello"; left 2 | plus "y" | ucase | print next ct.fig ***** p arr times 10 for countthis 1 10 1 z countthis str p arrset countthis z fig forin countthat p z "[This is string #" prints z countthat prints z "]" print fig command.fig ***** function commandstring python from sys import argv return " ".join(argv) fig fig z commandstring print # like command$ string.fig ***** p string 104 27 print z string 2 "55" print pete2.fig ***** function x y z p y p z p "this will act like a sub" print fig z 8 x 5 "pete" p z print function x y z p y p z p "this will act like a function" print RETURN Y fig z x "pete" "ian" p z print 111.fig ***** p arr arrset 1 1 p=10 : chr : prints p=10 | chr | prints p=10; chr().prints(); center.fig ***** width = 40 ## public domain ## text = "keep calm and System.out.printlin ('Hello World')" quot = 34 chr txt = split text "'" join txt quot split txt " " ## center each ## forin p txt half = p len times -1 plus width divby 2 int sp = " " times half prints now = p print next ins.fig ***** x : "hey" : instr x "e" print ef.fig ***** p string 104 27 print nstr.fig ***** # #public domain z : "ls" : arrshell forin p z ck : instr p ".fig" iftrue ck x : p : print fig nextin ef.fig ***** p string "h" 104 print defdef.fig ***** function hello p z p times 8 return z fig function heya f z "ok" print len hello f print times 5 return z fig z 7 heya z print ks.fig ***** p "hello there are words here" z p ucase # prints z split p " " # print forin skippy z thatsfine skippy print nextin jac.fig ***** FOR I = 1 10 1 Z = I PRINT NEXT Z = "I'M DONE" PRINT swap.fig ***** pink = 5 pin = "100" z = pink print swap z, pin : print : int : times 7 : print topwr.fig ***** x 5 topwr 2 print sub.fig ***** function hello sub z "well hey " prints z return "there" fig p "ok" hello sub print fig.fig ***** p arropen "../br.fig" #f "figt.txt" open "w" forin x p z x print #f next rc.fig ***** A = "HEY" : ARR : PLUS "HELLO WORLD" PLUS "GREETS" N = INSTR ( A, "HEY" ) STR P = "[" PLUS N PLUS "]" PRINT func.fig ***** p "hello" len python p = 1 / 3.0 + (p * (3 + 7 * 9) ** 5.7) fig z p print for.fig ***** for x (1, 5, 1) z = x : print() next wc.fig ***** ti "hello there how are you" split ti " " # split ti into words separated by " " forin p ti z p prints " has " prints z p len prints " characters." print next # fig also works here xp.fig ***** x print cd.fig ***** try p "/tmp/tmp" chdir except pass fig while z "hello" print sleep 2 wend v.fig ***** p 5 arr print #### create array #### define function function x p p print p arrset 1 "hello" fig #### print variable p p print #### call function z x p p print #### note: arrays work differently in scope to other variables. if passed, global mutable. #### to get value of a function parameter, use [b]get[/b]. #### to return non-array value, use [b]return[/b] (exits function.) left.fig ***** p "hello there" left 20 print pp "*" plus p plus "*" print lf.fig ***** p 120 str print function p z p get z times 5 return p fig z p 2 print p "20" val print eq.fig ***** p = "hello" x == "hey" a = "yes" : arr ifequal "hello" == p a : print fig ifequal "hey" = x a : print fig ifequal p == x pass else n == "no" : print fig ff.fig ***** function : hi : wd x : get wd z : x : print fig p hi 7 p hi 7 x : arr : arrset 1 "hi" print p plus 7 p print x plus 7 print x plus 7 join x "" z x print pal.fig ***** #### license: creative commons cc0 1.0 (public domain) #### http://creativecommons.org/publicdomain/zero/1.0/ function ckp ckfp ck get ckfp lcase b "" ## leave only alpha forin l ck forin a "abcdefghijklmnopqrstuvwxyz" ifequal l a z b plus l swap z b fig next next z b print d "" forin p b z p plus d swap z d next ifequal b d z ck print "is a palindrome" print 32 chr print else z ck print "is not a palindrome" print 32 chr print fig fig p ckp "do nine men INTERPRET? nine men, i nod!" func2.fig ***** st 7 function printasterisked st # no longer needed: z get st swap z gt z "*" plus st plus "*" print fig ppp "hello" printasterisked ppp ok st print lft.fig ***** x "hello" left 2 ``` 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