Re: Factor

Factor: the language, the theory, and the practice.

Visual REPL

Wednesday, September 8, 2010

#ui

Many of the recently successful programming languages have a REPL (“read-eval-print-loop”) for experimenting or iterative programming. Mostly these seem to be for dynamic languages, although there is even a C REPL! Almost invariably, these are text-based (with notable exceptions for math systems like Mathematica).

I thought it would be fun to highlight some of the visual aspects of Factor’s REPL (called the “listener”). For the examples below, it would be helpful to use these vocabularies first:

IN: scratchpad USING: colors http.client images.http io.styles ;

Styled Text

Print styled text directly to the listener’s output. You can change font sizes, foreground and background colors, font family, font style, and other aspects of the text:

Tab Completion

You can get word completion as you write code (by pressing TAB) in the listener:

Word Definitions

You can print the definition of any word using see. In addition, you can click on most parts of the output to link to vocabulary pages, word definitions, etc.:

Use apropos to search for words, vocabularies, and help articles. It uses some fuzzy completion algorithms to be more helpful for typos or approximations.

Viewing Images

Use the handy images.viewer vocabulary (written by Doug Coleman) to load and display images directly in the listener: