digital literacy for everyone
[lit][generate-title]
[lit]
one of various programs to help sort various fig programs. augments fsortlist output from [[../alex]] with an "ingredients list" of fig commands sorted by instance count. for example, running figcmp against its own code would return this list:
00000014 split 00000011 join 00000009 plus 00000008 swap 00000006 fig 00000005 mid 00000004 return 00000004 prints 00000003 next 00000003 ifmore 00000003 forin 00000002 val 00000002 str 00000002 rtrim 00000002 right 00000002 reverse 00000002 print 00000002 minus 00000002 len 00000002 lcase 00000002 chr 00000002 arrstdin 00000002 arrsort 00000002 arropen 00000001 while 00000001 wend 00000001 ucase 00000001 try 00000001 topwr 00000001 times 00000001 time 00000001 textmode 00000001 tan 00000001 system 00000001 string 00000001 sqr 00000001 sleep 00000001 sin 00000001 shell 00000001 sgn 00000001 resume 00000001 randint 00000001 pset 00000001 pass 00000001 open 00000001 oct 00000001 not 00000001 nextin 00000001 mod 00000001 ltrim 00000001 locate 00000001 lineinput 00000001 line 00000001 left 00000001 int 00000001 instr 00000001 iftrue 00000001 ifless 00000001 ifequal 00000001 highlight 00000001 hex 00000001 graphics 00000001 get 00000001 fprint 00000001 for 00000001 flineinput 00000001 except 00000001 end 00000001 else 00000001 divby 00000001 display 00000001 date 00000001 cos 00000001 command 00000001 colourtext 00000001 colortext 00000001 cls 00000001 close 00000001 chdir 00000001 break 00000001 atn 00000001 asc 00000001 arrshell 00000001 arrset 00000001 arrget 00000001 arreverse 00000001 arrcurl 00000001 arr
...followed by the usual size, sha256 hash, date, time and filepath that alex generally offers.
[fig]
#### license: creative commons cc0 1.0 (public domain)
#### http://creativecommons.org/publicdomain/zero/1.0/
proginf = "figcmp 0.1, jan 2019 mn"
fsl = arrstdin
tab 9 chr
function countf text find
lookfor = " " plus find plus " "
p = " " plus text rtrim plus " " ; split p lookfor ; len minus 1 ; return p
fig
function cleant text
p = split text "," join p " " ; swap p text
p = split text ";" join p " " ; swap p text
p = split text ":" join p " " ; swap p text
p = split text "|" join p " " ; swap p text
p = split text "(" join p " " ; swap p text
p = split text ")" join p " " ; swap p text
p = split text "." join p " " ; swap p text
p = split text "=" join p " " ; return p
fig
function tag text n
s = n str
p = "0000000" plus s ; right 8 ; plus " " plus text ; return p
fig
kwlist split "timer arrstdin lineinput flineinput time arropen date arrcurl sleep command print prints fprint display cls graphics textmode colourtext colortext highlight locate pset line while break for forin iftrue ifequal ifmore ifless try except resume else get fig next nextin wend pass lcase ucase str shell asc val len not ltrim rtrim chr arrshell arreverse reverse arrsort left right arrget arrset mid string split join instr chdir system close end open return swap plus minus divby times oct hex cos sin tan atn int sgn sqr mod topwr randint arr" " "
forin each fsl
top = split each tab mid 1 1
bot = split each tab mid 2 1
siz = split top " " mid 1 1 val
ifmore siz 0
text arropen bot ; join text " " ; cleant text ; lcase
counts arr mid 1 0
forin kws kwlist
countadd = countf text kws
cadd = tag kws countadd
ifmore countadd 0
counts plus cadd
fig
next
now counts arrsort reverse join now " " ; prints " " prints
now tab prints
now each print
fig
next
fig main page: [url]https://codeinfig.neocities.org/fig/index.html[url]
home: [lit]https://codeinfig.neocities.org[lit]