You can try expressions in the interactive listener. For example, some postfix arithmetic:
2 3 + 4 * .
"Hello world" print
Networking and web
C library bindings
Many of these bindings have easier to use wrappers (for example, there's no reason to use the Unix API directly, since all I/O is done with higher-level cross-platform APIs). Learn more about Factor's C library interface.
These examples are more complex than the above, and some of them were written a while ago and haven't been cleaned up to use the latest idioms. They are all runnable from the Factor UI if you have a good enough OpenGL driver -- just issue a command such as
Running the examples
Some of these examples define a MAIN: word. This means they are runnable from the Factor listener, by issuing a command such as the following,
Other examples are libraries, which means that after loading them with a command like this:
you can then get a list of words, and in some cases, API documentation:
and play around:
( scratchpad ) 123 >roman . "cxxiii"
Understanding the examples
If you see an example refer to a vocabulary in its
The about page gives a list of words with stack effects -- clicking on a word will display documentation for the word, if any, as well as its definition (which may not exactly match the source file definition, since its printed from its in-memory representation). For many vocabularies, a "Documentation" link at the very top gives an overview article as well.
If you see an example call a word you're unfamiliar with, make sure you load all required vocabularies by copying the example's
\ reverse help
This even works for bits of syntax:
\ MEMO: help
Finally, all of this reference documentation is also available online at http://docs.factorcode.org.
To see more examples of Factor code, download the Factor distribution and take a look in the
This revision created on Sat, 1 Aug 2015 09:45:02 by MaD70 (Updated links to git repository)
All content is © 2008-2010 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.