Factor

Join the Factor Track
TODO: The maintainers have not provided a description for this track.

0 Mentors

Our mentors are friendly, experienced Factor developers who will help teach you new techniques and tricks.

6 Students

Join hundreds of students who have enjoyed learning and improving their skills by taking this track.

4 Exercises

Hundreds of hours have gone into making these exercises fun, useful, and challenging to help you enjoy learning.

About Factor

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.
Join the Factor track
USING: formatting kernel sequences ;
IN: hello-world

: say-hello ( -- string )
  "Hello, World!" ;

A tremendous learning opportunity to explore the depth of your own knowledge

Exercism is fantastic in learning new languages but that is not the extent of it. If you are a "more experienced" programmer you may have encountered impostor syndrome: the idea you don't really know what you think you know. Exercism lets you solve problems and put them in the space of open feedback which is a tremendous learning opportunity to explore the depth of your own knowledge. Even if you have been programming in a language for awhile it is worth checking into Exercism to see where you stand with current implementation practices.

Fun. Challenging. Interesting

Community-sourced Factor Exercises

These are a few of the 4 exercises on the Factor track. You can see all the exercises here.

Hello World
medium
easy
stack effect
word definition
Leap
medium
easy
conditionals
logical operators
quotations
word definition
Two Fer
medium
easy
quotations
stack effect
text formatting
word definition
Isogram
medium
easy
stack effect
strings
word definition

Get started with the Factor track. As with everything on Exercism, it's 100% free!

Join the Factor Track