RunningFoment - leftmike/foment GitHub Wiki

Foment works on Windows, Mac OS X, Linux, and FreeBSD.

If you are using Windows, you will need at least Windows Vista for it to work. To see more Unicode characters, change the font of the console window from a raster font to a TrueType font.

Foment can be used to run a Scheme program or to interactively read and evaluate Scheme expressions.

Running a Program

foment option ... [--] program arg ...

Compile and run the program in the file named program. There may be zero or more options and zero or more arguments.

The command-line procedure will return from program to the end of command line arguments as a list of strings. The full-command-line procedure will return all of the command line arguments as a list of string.

Use foment --help to list all available options.

SRFI 22: Running Scheme Scripts on Unix

To run a Scheme program as a script, put #! /usr/local/bin/foment as the first line of the script. And change the path to wherever that Foment is installed.

If the progam contains a main procedure, then it will get called with a list of the command line arguments to the script. The first element of the list is the name of the script. The main procedure should return an integer which becomes the exit status of the script.

Running an Interactive Session

foment option ... [--] arg ...

If there is no program specified or at least one of the options -i (--interactive, --repl), -p (--print), or -e (--eval, --evaluate) are specified, then foment will run an interactive session.

Running in Batch Mode

foment option ... [--] arg ...

If one of the options -b or --batch is specified, then foment will run in batch mode: standard input will be read and treated as a program.

Using Foment

As an extension to R7RS, eval recognizes (define-library ...) and loads it as a library. This works in an interactive session and when a file is loaded via load or -l on the command line. As a result, you can start developing your program and libraries all in one file and run it via -l on the command line.

Interactive Session

The REPL uses editline which provides interactive editing of lines of input.

ctrl-a : beginning-of-line
ctrl-b : backward-char
ctrl-d : delete-char
ctrl-e : end-of-line
ctrl-f : forward-char
ctrl-h : delete-backward-char
ctrl-k : kill-line
alt-b : backward-word
alt-d : kill-word
alt-f : forward-word
backspace : delete-backward-char
left-arrow : backward-char
right-arrow : forward-char

⚠️ **GitHub.com Fallback** ⚠️