Farnsworth

From Esolang
Jump to navigation Jump to search

Farnsworth is an interpreted toy language created by Ryan Voots (simcop) in 2010. One of its uses was to convert between measurement units and currencies in IRC using an IRC bot that evaluates Farnsworth expressions, but the language kept growing from there.

Farnsworth has built-in dimensioned numbers (numbers possibly multiplied by powers of primitive measurement units like meter or second). There are primitive and derived units defined by the standard library, but you can also define new primitive units. SI prefixes like kilo are parsed even when prefixed to a unit without any separator, eg. you can write attoparsecs and Farnsworth will know that that's the product of the prefix atto with the unit parsecs. Farnsworth has built-in first-class functions, arrays, dates.

A notable syntactic feature of the language is that you can juxtapose two expressions without anything between to either call a first-class function with a single argument or multiply two numbers. The latter is needed to conveniently write numbers with measurement units. Postcircumfix square brackets are used to call functions with any arity, sort of like in Mathematica. You can, in fact, also call first-class functions of a single argument with an explicit multiplication operator *.

Links