Re: Factor

Factor: the language, the theory, and the practice.

Readline support for Factor

Wednesday, February 18, 2009

#command-line

When using Factor from the command line, you might notice that it lacks many of the features of typical REPL’s offered by other languages. For example, using arrow keys, home, end, delete, and backspace to navigate and edit text, and having proper history support for using previous lines of text.

These features are often implemented by using the GNU Readline library.

But, how do you use readline with Factor? The easiest way is to use the rlwrap command, which wraps an arbitrary command in readline.

To install it on Linux, run sudo yum install rlwrap (for RPM-based distros) or sudo apt-get install rlwrap (for Debian-based distros).

On the Mac, you can install it with the MacPorts system by running sudo port install rlwrap.

Once installed, add rlwrap in front of your factor command. For instance:

$ rlwrap ./factor

You should find interacting with Factor to be much easier.