Gnomon is an interactive, scriptable calculation environment with a standard library of mathematical, statistical and plotting functions. It is available as an integrated graphical environment for Mac OS X 10.6 or greater, is soon to be available for both iPhone and iPad on the app store, and is also available as a command line application (minus the graphics features) for both Mac and Windows.
The name Gnomon comes from the ancient Greek γνώμων - one that knows, an interpreter, discerner. In English the word is used to describe the shadow casting indicator of a sundial, hence the icon.*
For details of the scripting language, see the Language Definition page.
For details of the standard library, see the Standard Library page.
The main window is a grid of four panes - the Worksheet, Scratch, Session and Plot areas.
The Worksheet pane is the primary area for entering commands. Any rich text can be entered into the Worksheet – not only calculation instructions, and auto-completion is supported via the escape or F5 keys (showing built-in functions and variables by default, user functions and variables if the option key is pressed). Shift-enter sends either the selection or the current line if no selection to the interpreter. Multiple line selection is supported. The commands are echoed in the "Session" area in green following a '#' prompt, and any corresponding output follows in blue. Error messages appear in red and execution halts at the first error. Print, by default, will print the Session pane. Holding down the option key will cause the print function to print the Worksheet instead.
The Scratch area is also for entering commands, and is convenient if you wish to avoid interfering with any structured input in the worksheet.
The Plot area shows the current graphic. Double clicking the plot will cause it to pop out as a child window, and the graphic can then be copied, scaled, and manipulated in 3D where appropriate. Rotation and tilting in 3D is via swipe and rotate gestures, or by clicking and dragging the mouse. Zooming in and out is via pinch gestures or shift-dragging with the mouse. Double clicking the horizontal divider will maximise the output panes.
The iPhone/iPad interface supports cell-based interactive entry with expandable cells for graphics and large text output. It also supports free text entry in worksheets analogously to the Worksheet pane in the Mac version. A custom keyboard accessory presents all the required symbols that are not present on the default alphabetic and numeric keyboards, thus minimising the required keyboard switching.
A detailed walkthrough of this interface is provided here: iOS Interface.
The command line version of the Gnomon Interpreter runs on both Mac and Windows. The command history is maintained both during and between sessions, and can be navigated using the arrow keys. Autocomplete for standard library functions is supported via the tab key, and graphics functions are not available. The command line application can be run either interactively, or invoked with a source file in which case it will process the commands in the file and then terminate.
The interpreter is invoked using
Gnomon [-c0|-c1|-c2] [-quiet] [filename]where the -c options select a particular colour scheme, the -quiet option will prevent echoing of commands from input files, and filename is the name of a command file to load and execute. For the colour options, -c0 selects black text for Mac and white text for Windows, -c1 (default for Mac) selects colours appropriate for a terminal with a light background, and -c2 (default for Windows) selects colours appropriate for a terminal with a dark background.
Current version is 2.2 (17 Dec 2014)
Here is a Sample Session illustrating many interactive and programmatic features of the interpreter. (Click here to download the associated worksheet.)
Here is a Graphics Sample illustrating some of the plotting features of the interpreter. (Click here to download the associated worksheet.)
Project Euler presents a series of interesting and challenging mathematical problems that are solvable by computational means. As such it provided a valuable context for studying the completeness and effectiveness of the Gnomon language, and for testing the interpreter.
Here is a discussion of several Project Euler problems and their solution using Gnomon on an iPad: Solutions. The associated worksheet can be downloaded here: Worksheet, and run on using the Mac version to produce the following output: Session.
The Gnomon Language and Software is copyright (c) Ken Wessen 2012-15