You are not logged in or registered. Please login or register to use the full functionality of this board...
SIGN IN Join Our Community For FREE


command frequency from a large collection of programs
08-12-2017, 01:13 AM
Post: #1
 (Print Post)
command frequency from a large collection of programs
i think it would be interesting to find out what (types of) commands people use the most frequently. some educated guesses should be easy-- this is from a very large sample of fig programs ive written:

Code Snippet: [Select]
$ p=$(find -print0 | grep -z "\.fig$" | xargs --null wc -w | cat -n | tail -1) ;
c="print 'average number of commands per program:', 1/$(echo $p | sed 's/total//'|sed 's/\ /.0\*/')" ;
echo "$c" | python

average number of commands per program: 28.737337745 (lots of demos and things i wrote to check out that commands are working as intended. i figure a median value would be more illustrative.)

which commands are used the most frequently?


Code Snippet: [Select]
$ f="^timer|arrstdin|lineinput|flineinput|time|arropen|date|arrcurl|sleep|command" ;
f="$f|print|prints|fprint|display|cls|graphics|textmode|colourtext|colortext|highlight" ;
f="$f|locate|pset|line|while|break|for|forin|iftrue|ifequal|ifmore" ;
f="$f|ifless|try|except|resume|else|function|get|python|fig|next" ;
f="$f|nextin|wend|pass|lcase|ucase|str|shell|asc|val|len" ;
f="$f|not|ltrim|rtrim|chr|arrshell|arreverse|reverse|arrsort|#|left" ;
f="$f|right|arrget|arrset|mid|string|split|join|instr|chdir|system" ;
f="$f|close|end|open|return|swap|plus|minus|divby|times|oct" ;
f="$f|hex|cos|sin|tan|atn|int|sgn|sqr|mod|topwr|randint|arr$" ;
f=$(echo $f|sed "s/|/\$\|\^/g") ;
p=$(find -print0 | grep -z "\.fig$" | xargs --null echo) ; for x in $p ;
do cat "$x" ; done | tr ' ' '\n' | tr A-Z a-z | egrep "$f"| sort| uniq -c| sort -n| tac| column -c 100


output:

Code Snippet: [Select]
12198 plus               1196 shell               554 ifmore              186 reverse
   9968 print              1172 arrget              540 mod                 169 command
   7218 fig                1124 mid                 523 ucase               168 flineinput
   6195 #                  1099 else                468 sin                 166 close
   3834 prints             1088 while               461 textmode            152 fprint
   3771 swap               1054 wend                442 cos                 150 ltrim
   3652 next                982 divby               427 join                148 graphics
   3191 for                 947 split               408 sgn                 135 time
   3060 times               943 str                 392 not                 102 date
   2636 get                 924 arrset              383 instr                92 rtrim
   2525 colortext           863 len                 380 end                  80 chdir
   2447 locate              816 display             349 cls                  68 arrcurl
   2322 minus               788 val                 332 ifless               65 arrsort
   2233 randint             787 pset                315 arropen              55 atn
   2012 function            761 pass                305 try                  52 arrstdin
   1744 ifequal             703 lineinput           304 except               51 timer
   1722 highlight           698 break               292 arreverse            32 topwr
   1686 int                 697 return              280 resume               29 sqr
   1577 chr                 689 python              263 arrshell             27 tan
   1541 sleep               671 left                247 string               23 hex
   1535 iftrue              588 line                221 open                  5 system
   1513 forin               582 nextin              193 lcase                 4 oct
   1378 arr                 563 right               188 asc                   2 colourtext
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - RGB Color Wheel
QB64 Member Project - Rotating Background
QB64 Member Project - Domain
QB64 Member Project - Splatter
QB64 Member Project - Swirl
QB64 Member Project - Exit
QB64 Member Project - Point Blank
QB64 Member Project - Spiro Roses
QB64 Member Project - Qubic
QB64 Member Project - Bowditch curve
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Dakapo
QB64 Member Project - 9 Board
QB64 Member Project - Color Rotating Text
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Othello
QB64 Member Project - Color Triangles
QB64 Member Project - Connect Four
QB64 Member Project - Inside Moves
QB64 Member Project - Overboard
QB64 Member Project - Sabotage
QB64 Member Project - Pivot version two
QB64 Member Project - Martin Fractals version four
QB64 Member Project - Touche
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Kings Court
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Basic Dithering
QB64 Member Project - Pivet version one
QB64 Member Project - Blokus
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Isolation
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - Score 4
QB64 Member Project - Foursight
QB64 Member Project - Input
QB64 Member Project - Amazon
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Line Thickness
QB64 Member Project - Rubix's Magic
QB64 Member Project - Martin Fractals version one
QB64 Member Project - ARB Checkers
QB64 Member Project - OpenGL Triangles
QB64 Member Project - Quarto
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Algeria Weather
QB64 Member Project - Dreamy Clock