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 <
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.
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 ]