Factor is a mature, dynamically typed language based on the concatenative paradigm. Getting started with Factor can be daunting since the concatenative paradigm is different from most mainstream languages. This tutorial will:
•
Guide you through the basics of Factor so you can appreciate its simplicity and power.
•
Assume you are an experienced programmer familiar with a functional language
•
Assume you understand concepts like folding, higher-order functions, and currying
Even though Factor is a niche language, it is mature and has a comprehensive standard library covering tasks from JSON serialization to socket programming and HTML templating. It runs in its own optimized VM with very high performance for a dynamically typed language. It also has a flexible object system, a Foreign Function Interface to C, and asynchronous I/O that works a bit like Node.js, but with a much simpler model for cooperative multithreading.
Factor has a few significant advantages over other languages, most arising from the fact that it has essentially no syntax:
•
Refactoring is very easy, leading to short and meaningful function definitions
•
It is extremely succinct, letting the programmer concentrate on what is important instead of boilerplate
•
It has powerful metaprogramming capabilities, exceeding even those of LISPs
•
It is ideal for creating DSLs
•
It integrates easily with powerful tools
A few file paths in the examples may need to be adjusted based on your system.
The first section gives some motivation for the peculiar model of computation of concatenative languages, but feel free to skip it if you want to get your feet wet and return to it after some hands on practice with Factor.