FPr (programming language)
Stable release | 20101025 |
---|---|
Operating system | Windows |
Type | Function-level Programming Language Interpreter |
Website | fpstefan.de |
FPr (Function-level Programming right-associative) is a programming language that is an implementation of an FP-System. FP was invented by John Backus and described in his Turing Award lecture.[1] FPr features the list-techniques of Lisp and some techniques of object-oriented programming especially the use of the infix notation. FPr offers an alternative for the usage of local variables.
Example
len == lenrec ° id, (0 &), nil lenrec == (nilp ° 1) -> 2 ; lenrec ° (tail ° 1), (2 + 1 &), nil
Defines the function len for counting the elements of a list-object and the recursive function lenrec which is doing the loop.
len : (list :: aa bb cc dd ee)
Applicates the function len to a list-object with 5 elements.
Quicksort in FPr
"At the Beginning for the Automation"
qsort ° text1
"Definition of Quicksort for List Processing"
qsort==nilp->id;
((qsort°3)++1,qsort°4)
°((not°nilp°2)->*1,(tail°2),(1>1°2)->(((1°2),3),4,nil);3,((1°2),4),nil)
°1,tail,(nil as _1),(nil as _1),nil
"The Argument for this Example"
text1==(list :: Advantages of FP systems . The main reason FP systems are considerably simpler than
either conventional languages or lambda-calculus-based languages is that they use only the most
elementary fixed naming system [naming a function in a definition] with a simple fixed rule of
substituting a function for its name . Thus they avoid the complexities both of the naming systems of
conventional languages and of the substitution rules of the lambda calculus . FP systems permit the
definition of different naming systems [...] for various purposes . These need not be complex, since
many programs can do without them completely . Most importantly, they treat names as functions that can
be combined with other functions without special treatment .)&
See also
- FP (programming language)
- Function-level programming
References
- ↑ John Backus Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs (PDF). Stanford University, 1978