Saturday, January 8, 2011
Factor can use several configuration files as part of its startup routine.
At startup, Factor looks for a
factor-rc on Windows)
file in your
$HOME directory. If found, it will attempt to run the
contents of this file as Factor source code.
For example, if you’d like to have Factor print
"Hello, World!" when
it starts up, you can modify your
factor-rc file to say:
USE: io "Hello, World!" print
Then try and start Factor from the command-line and it should look something like this:
$ factor Loading $HOME/.factor-rc Hello, World! IN: scratchpad
More practically, if you want to always use a particular editor with
Factor (e.g., MacVim), you can
USE: it in your
For more information, see run-user-init.
When performing the bootstrap process (e.g., making a new VM image),
Factor looks for the
factor-boot-rc on Windows)
file in your
$HOME directory. In this file, you can use the
word to load vocabularies you use frequently.
For example, if you’d like to have the
vocabulary code loaded into the image (for the
printf word), you can
add this to your
USE: vocabs.loader "formatting" require
The next time you bootstrap Factor, the new image should have loaded the
For more information, see run-bootstrap-init.
By default, Factor looks in
$FACTOR/work for vocabularies. It is frequently
useful to specify additional vocabulary roots. Factor looks for the
factor-roots on Windows) in your
for additional vocabulary paths.
For example, if you want to use the code I’ve
written as part of this blog, then
you can checkout the
re-factor code somewhere. Then, add the full path
re-factor directory as a line in the
factor-roots file. Next
time you run Factor, you should be able to
USE: vocabularies from