free software resistance
the cost of computing freedom is eternal vigilance
### fig-commands-ranked-by-frequency
*originally posted:* nov 2024
this represents nearly a decade of use. on my local filesystem, the these fig commands are ranked by frequency:
1. shell - run shell commands
2. plus - add a number to a number, a string to a string or an item or array to an array
3. fig - complete a multiline command
4. print - output text to screen / stdout
5. prints - "print semicolon"; print/stay on line
6. colortext - change the colour that text is printed with
7. next - complete a multiline command, including a for loop
8. iftrue - conditonal based on non-zero numbers, non-zero-length strings or non-zero-length arrays
9. ifequal - conditional based on values matching
10. split - convert a string to an array based on a string separator
11. function - define a function
12. times - multiply a numeric or string value by a number
13. int - truncate a numeric value at the decimal point
14. chr - return a character based on numeric value
15. fprint - write text to a file
16. mid - get part of a string or array
17. join - join an array into a string
18. python - include inline python code
19. chdir - change the cwd
20. return - quit a function and return a value to the line that called it
21. instr - determine the location of a string in another string, or an item in an array
22. else - run conditional code if the condition is not true
23. swap - exchange values between two variables
24. forin - iterate though a string or array
25. minus - subtract a numeric value from another
26. len - return the length of a string
27. open - open a file for reading or writing
28. close - close a file opened with open
29. arrshell - run shell commands and pipe output back to array
30. for - start a for loop
31. try - begin trapping errors
32. except - if error encountered, run following code
33. ifmore - conditional
34. while - begin loop
35. arr - convert value to array that includes value
36. divby - divide number by next value on line
37. break - exit the loop
38. right - truncate string by length, keep right part
39. resume - same as fig or next, matches try/except
40. sleep - pause for n seconds
41. pass - does nothing, basically a placeholder for error trapping
42. reverse - reverse order of array or string
43. display - first use, stop updating graphics; each other use: update (obsolete, kept for compatibility)
44. ltrim - remove whitespace from left side of string
45. left - truncate string by length, keep left part
46. rtrim - remove whitespace from right side of string
47. randint - return pseudorandom number ranging from first to second number
48. sin - return sine of angle in radians
49. wend - same as fig or next, matches while loop
50. cos - return cosine of angle in radians
51. arrget - get a value from single item from array
52. line - draw a line
53. highlight - set background colour of text
54. lcase - remove capitalisation from each letter in string
55. val - convert string to numeric
56. ifless - true-based conditional
57. locate - move to row, column on screen or window
58. pset - draw a dot at coordinates with colour
59. lineinput - get a line of text from keyboard
60. arropen - return array including lines of text from file
61. str - return string value converted from numeric value
62. arrset - set main variable array item to next value on line
63. command - return array of command line parameters
64. mod - modulus
65. arrstdin - return array of all text piped into program
66. arrcurl - retrieve text from webpage online
67. get - set main variable to value of next variable on line (mostly obsolete, kept for compatibility)
68. not - convert false values to true, true values to false
69. asc - return ascii or unicode value of first character of string
70. sgn - return -1 if number < 0, return 0 if 0, return 1 if > 0
71. system - same as end
72. cls - clear the text screen
73. textmode - force text mode even if graphics commands used / pygame installed (obsolete, kept for compatibility)
74. end - quit program
75. arreverse - reverse contents of array
76. oct - return octal value of number
77. tan - return tangent of angle in radians
78. ucase - capitalise all letters in string
79. colourtext - same as colortext
80. sqr - return square root of number
81. nextin - same as fig or next, barely used
82. arrsort - sort contents of array
83. flineinput - get line of text from open file, meant to work with files too large for arropen
84. graphics - switch from textmode to graphics mode (obsolete, kept for compatibility)
85. time - return a string with hh:mm:ss format
86. hex - convert number to hex value
87. topwr - raise a number to the power of n
88. date - return a string containing the date in mm/dd/yyyy format
89. timer - return the number of second since midnight
90. atn - return the arctangent of an angle in radians
```
for each in $(find . -type f -name '*.fig') ; do cat $each | ./noqc.fig.py ; done | tr "|" " " | tr ")" " " | tr "(" " " | tr ":" " " | tr "-" " " | tr "." " " | tr ";" " " | tr "=" " " | tr " " "\n" | tr A-Z a-z | sort | uniq -c | sort -n
```
```
cat ./noqc.fig
p arrstdin
q 34 chr
c "#"
forin each p
buf arr mid 1 0
isq 0
isc 0
forin l each
iftrue isq
ifequal l q
isq 0
next
else
ifequal l q
isq 1
else
buf plus l
next
next
next
each join buf ""
buf arr mid 1 0
forin l each
iftrue isc
ifequal l c
isc 1
next
else
ifequal l c
isc 1
else
buf plus l
next
next
next
each join buf "" print
next
```
license: 0-clause bsd
```
# 2018, 2019, 2020, 2021, 2022, 2023, 2024
#
# 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