Using fig

Fig comes with a few code examples, in the /usr/share/doc/fig/examples filepath. You can view them with this command:

geany /usr/share/doc/fig/examples

To compile one of the examples, try giving these lines at the console: /usr/share/doc/fig/examples/nestloops.fig

The first line compiles (translates) nestloops.fig to, and the second line runs the resulting Python script.

The main difference between and is the first one runs in Python 2, and produces scripts for Python 2; while runs in Python 3 and produces Python 3 scripts.

The feature sets of these are almost identical: fig 3.1 in addition to the features of previous verions, has a neat help feature: help

...and also has a function named "command" (taken from basic) which gets arguments from the command line. But you can create a compatible command in fig 2.9 like this:

#### license: creative commons cc0 1.0 (public domain) 
function cmd
    from sys import argv as figargv ; return figargv[1:]

The rest of the information you get from the help feature in fig 3.1 will be valid for fig 2.9.

You can also try the 4 fig utilities in /usr/bin by compiling them with

for p in /usr/bin/*.fig ; do $p ; done | grep py

One of those programs is called arrname.fig and can be used this way:

find /usr/share/doc/fig/examples | 1 

...will show the file paths of all the entries under /usr/share/doc/fig/examples (this is more useful on a path with more subfolders.)

find /usr/share/doc/fig/examples | 2 

...will show the file names of all the entries under /usr/share/doc/fig/examples. And:

find /usr/share/doc/fig/examples | 3 

...will show the file extensions of all the entries under /usr/share/doc/fig/examples.

The find command lists entries in this format:

filepath / filename . extension (If there is an extension.)

Graphics in fig

Fig is capable of producing graphics with pygame. By default, if pygame is not installed then fig will emulate graphics in the term using ANSI escapes and unicode.

Installing pygame is trivial for fig 2.x and Python 2: sudo apt-get install python-pygame ...for fig 3.x you will need the version of pygame for Python 3 (you can install both):

> How-to-install-pygame-for-Python-3

< Learn-about-the-fig-programming-language

<< Fig OS Manual