Factor

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

0 Mentors

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

7 Students

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

4 Exercises

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

About Factor

USING: formatting kernel sequences ;
IN: hello-world

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

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

Exercism is a great website

What I like about it is that I am able to solve the challenges in a TDD way working in a environment that I am familiar (my own PC not a browser IDE) and the cherry on the top of the cake is that I have access to code reviews.

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.

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

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

Join the Factor Track