Factor was originally designed by Slava Pestov in 2002, as a scripting language implemented on the JVM for game engines. The platform and ecosystem has come a long way since that time, as has the core of the language itself. Factor's standard library has grown enormous, and its implementation, including its self-hosting native code optimising compiler, is now written almost entirely in Factor.

Factor can create standalone, and even GUI applications that behave exactly the same on Linux, Windows and Mac OS.

Factor is a simple, yet powerful and expressive stack-oriented high-level language in the vein of Forth, Joy and Lisp. It proposes a concatenative (point-free and compositional) model of data flow, alongside extreme extensibility and a CLOS-derived object system.

Homoiconicity is a large part of Factor's programming model. All values, including functions and blocks of Factor code, go on the same stack and can be manipulated in the same way. This is a simple, yet powerful paradigm that invites interesting solutions to problems, and indefinite extensibility.

Factor requires from the reader a mindset apart from C or Python. Because of its compositional programming model, each function's output is used as input to the next one. Functions can use other functions or blocks of literal Factor code as input. In this way, it's rather like a (one-directional) Unix pipeline, but far more advanced while being less complicated. It takes some getting used to, but interactive development and re-Factoring are encouraged, and becomes quite fun and interesting to use.

The Factor programming language is open source, and you can find it in active development on GitHub.

If you're even a little bit new to Factor, it's highly recommended you read the Factor cookbook and Your first program sections of the Factor documentation before continuing.

Glossary of Factor terms

  • Word Essentially a function, which takes its arguments from, and returns values to, the stack. All words must have a declared stack effect. All elements of Factor's syntax are words, which makes defining new syntax very easy.
  • Vocabulary A collection of words organised in a directory or source-file, like a module or library in other languages.
  • Stack A last-in-first-out list of references to dynamically-typed values used for all operations; the primary way of passing data between functions. It is an implementation detail; Factor could be mostly implemented using term rewriting.
  • Program A series of words that manipulate the stack at runtime. This gives the language a powerful foundation which allows many abstractions and paradigms to be built on top.

Help us explain this better! File a GitHub issue at https://github.com/exercism/factor/issues if you have suggestions, or submit a patch with improvements to the https://github.com/exercism/factor/blob/master/docs/ABOUT.md file.

Try It!

If you've downloaded the command-line client and have Factor installed on your machine, then go ahead and fetch the first problem.

exercism fetch factor

In order to be able to submit your solution, you'll need to configure the client with your Exercism API key.

exercism configure --key=YOUR_EXERCISM_KEY

When you've written a solution, submit it to the site. You'll have to configure the command-line client with your exercism API key before you can submit.

exercism submit PATH_TO_FILE