Refal

Refal
ParadigmPattern-matching and term-rewriting
Designed byValentin Turchin
DeveloperValentin Turchin, S. Florentsev, V. Olyunin, et al.
First appeared1968 (1968)
Typing disciplinestrong, dynamic
Websitehttp://www.refal.net
Major implementations
Refal-2, Refal-5, Refal-6, Refal+

Refal ("Recursive functions algorithmic language"; Russian: РЕФАЛ) "is a functional programming language oriented toward symbolic computations", including "string processing, language translation, [and] artificial intelligence".[1] It is one of the oldest members of this family, first conceived of in 1966 as a theoretical tool, with the first implementation appearing in 1968. Refal was intended to combine mathematical simplicity with practicality for writing large and sophisticated programs.

One of the first functional programming languages to do so, and unlike Lisp of its time, Refal is based on pattern matching. Its pattern matching works in conjunction with term rewriting.

The basic data structure of Lisp and Prolog is a linear list built by cons operation in a sequential manner, thus with O(n) access to list's nth element. Refal's lists are built and scanned from both ends, with pattern matching working for nested lists as well as the top-level one. In effect, the basic data structure of Refal is a tree rather than a list. This gives freedom and convenience in creating data structures while using only mathematically simple control mechanisms of pattern matching and substitution.

Refal also includes a feature called the freezer to support efficient partial evaluation.

Refal can be applied to the processing and transformation of tree structures, similarly to XSLT.[2]

  1. ^ Turchin, Valentin F. (1989). "Introduction to Refal". REFAL-5 programming guide & reference manual. Holyoke: New England Publishing Co. Archived from the original on 2008-07-03. Retrieved 2010-04-05.
  2. ^ "Refal: The Language for Processing XML Documents". Archived from the original on 2007-12-06. Retrieved 2008-03-18.