Search

The Online Encyclopedia and Dictionary

 
     
 

Encyclopedia

Dictionary

Quotes

 

FL programming language

FL (short for Function Level) is a programming language created at the IBM Almaden Research Center by John Backus, John Williams, and Edward Wimmers in 1989.

FL was designed as a successor of Backus' earlier FP programming language, providing specific support for what Backus termed function-level programming. The primary design guideline was to achieve a simple and useful semantics that would enable the programmer to write clear and concise programs. The result was arguably one of the most unconventional programming languages to date.

Contents

Features

  • no static typing (like J, unlike most other functional languages)
  • first-class exceptions (somewhat like Standard ML, unlike most other functional languages)
  • strict semantics (like ML and J, unlike Haskell and Miranda)

Overview

FL's strategy to achieve clarity and conciseness is to allow the programmer to straightforwardly write programs at the function level—that is, by putting together (using functionals) existing programs to form new ones, rather than by manipulating values and then abstracting (using lambda expressions) from those values to produce programs. The end result is programs that have a rich mathematical structure and that may be transformed and optimized according to an underlying algebra of programs.

A by now archetypical example of the difference between the function-level and the lambda-style of programming is the program SumAndProd, which computes the sum and product of two numbers.

In a lambda-calculus based language, one begins with the values x and y and constructs the object ⟨x+y, x×y⟩ (sequences in FL are written ⟨x1,...,xn⟩ ), and then proceeds to abstract with respect to x and y producing a program:

def SumAndProd ≡ λ(x,y).⟨x+y, x×y⟩

In contrast, in FL (as in other function-level languages) one begins with the functions + and × and applies the functional construction, written [...], and which is defined so that for any functions f1,...,fn, the function [f1,...,fn] applied to x produces the n-element sequence whose ith element is fi applied to x:

[f1,...,fn]:x  =  ⟨f1:x,...,fn:x

(Note that the application of function f to value x is written f:x). This results in the variable-free function-level definition:

def SumAndProd ≡ [+,×]

A sample execution of the function-level SumAndProd (→→' denotes one or more steps in the reduction):

SumAndProd: ⟨2,3⟩
→→  [+,×]:⟨2,3⟩          (replacing the definition of SumAndProd)
→→  ⟨+:⟨2,3⟩, ×:⟨2,3⟩⟩     (application of construction)
→→  ⟨5,6⟩

Code examples

The composition functional (written &#x°) can be used to create new functions from more primitive ones. (In FL, s1 is the primitive function that selects the first element of a sequence, s2 the second, tl returns all but the first element of the sequence.) You can define an equivalent of s2 as:

def second ≡ s1&#x°tl

See also

The contents of this article are licensed from Wikipedia.org under the GNU Free Documentation License. How to see transparent copy