Factor source code is organized into
Vocabularies. Before we can write our first program, we must create a vocabulary for it.
Start by loading the scaffold tool:
USE: tools.scaffold
Then, ask the scaffold tool to create a new vocabulary named
palindrome:
"palindrome" scaffold-work
If you look at the output, you will see that a few files were created in your “work” directory, and that the new source file was loaded.
The following phrase will print the full path of your work directory:
"work" resource-path .
The work directory is one of several
Vocabulary roots where Factor searches for vocabularies. It is possible to define new vocabulary roots; see
Working with code outside of the Factor source tree. To keep things simple in this tutorial, we'll just use the work directory, though.
Open the work directory in your file manager, and open the subdirectory named
palindrome. Inside this subdirectory you will see a file named
palindrome.factor. Open this file in your text editor.
You are now ready to go on to the next section:
Writing some logic in your first program.