The Factor Language Blog Mirror

This site is intended to archive the Blogger post of Slava Pestov. It contains many early ideas, technical details, and designs that went into the Factor Programming Language. In order to guard against Google obsolescing Blogger, this mirror was created.

> Enter mirror of factor-language.blogspot.com <

What is Factor?

Factor is a concatenative, stack-based programming language. It includes high-level features such as dynamic types, extensible syntax, macros, and garbage collection. It has a feature rich library and is fully compiled with support for x86-64 Windows, Linux, and MacOS.

Learn more at factorcode.org.

An Example of Factor:

USING: combinators io kernel math.order math.parser random
ranges ;
IN: simple-guessing-game

: intro ( -- )
    "I'm thinking of a number between 1 and 100" print ;

: pick-number ( -- n )
    100 [1..b] random ;

: read-number ( -- n )
    "Enter a guess: " write readln dec> ;

: guessing-game ( n -- )
    dup read-number <=> {
        { +lt+ [ "Too high!" print t ] }
        { +gt+ [ "Too low!"  print t ] }
        [ drop   "You won!"  print f ]
    } case [ guessing-game ] [ drop ] if ;

MAIN: [
    intro
    pick-number
    guessing-game
]  
            

Relivatne Links

  • Factor's main website
  • SVFIG Talk about Factor
  • Factor on Rosetta Code
  • The Concatenative Wiki