FP (programming language)

This is an old revision of this page, as edited by Danakil (talk | contribs) at 18:56, 14 August 2004 (Overview). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

FP (short for Functional P programming) is a programming language created by John Backus to support the Function-level programming paradigm.

Overview

The values that FP programs map into one another comprise a set which is closed under sequence formation:

if x1,...,xn are values, then the sequencex1,...,xn⟩ is also a value

These values can be built from any set of atoms: booleans, integers, reals, characters, etc.:

boolean   : {T, F}
integer   : {0,1,2,...,∞}
character : {'a','b','c',...}
symbol    : {x,y,...}

is the undefined value, or bottom. Sequences are bottom-preserving:

x1,...,,...,xn⟩  =  

FP programs are functions f that each map a single value x into another:

f:x represents the value that results from applying the function f to the value x

Functions are either primitive (i.e., provided with the FP environment) or are built from the primitives by program-forming operations (also called functionals). An example of one such operation is constant, which transforms a value x into the constant-valued function . Functions are strict:

f: = 

Some functions have a unit value, such as 0 for addition and 1 for multiplication:

unit +  =  0
unit ×  =  1

Functionals

These are are the principal functionals of FP:

constant              where   :y = x
composition  f&#x°g        where    f&#x°g:x = f:(g:x)
construction [f1,...fn] where   [f1,...fn]:x =  ⟨f1:x,...,fn:x
condition (hf;g)    where   (hf;g):x   =  f:x   if   h:x  =  T
                       and     (hf;g):x   =  g:x   if   h:x  =  F
                       and     (hf;g):x   =      otherwise
apply-to-all  αf       where   αf:⟨x1,...,xn⟩ = ⟨f:x1,...,f:xn
insert-right  /f       where   /f:⟨x⟩  =  x
                       and     /f:⟨x1,x2,...,xn⟩  =  f:⟨x1,/f:⟨x2,...,xn⟩⟩
                       and     /f:⟨ ⟩  =  unit f
insert-left  \f       where   \f:⟨x⟩  =  x
                      and     \f:⟨x1,x2,...,xn⟩  =  f:⟨\f:⟨x1,...,xn-1⟩,xn⟩
                      and     \f:⟨ ⟩  =  unit f