# FPr

Appeared in:
2009
Influenced by:
Typing discipline:
File extensions:
.fp
Versions and implementations (Collapse all | Expand all):
Programming language

FPr (Function-level Programming right-associative) is an implementation of an FP-System. FPr features the list-technics of Lisp and some technics of object-oriented programming especially the use of the infix notation. FPr offers an alternative for the usage of local variables.

## Elements of syntax:

Non-nestable comments "" no abc or +-*/ ident == term ( ... ) test -> then ; else test ->* body list map term&

## Examples:

### Factorial:

Example for versions FPr

This example provides a list of factorials from 0 up to 16. Factorialb is the non-recursive version.

(seq:16) map factorial&

seq == (0&),iota
factorial == (id=0&) -> (1&) ; id*(factorial°id-1&)

factorialb == ((1&),iota) \ (1*2)&

Example for versions FPr

This example defines the function quadratic which accepts coefficients of quadratic equation and outputs the roots as string. Usage is quadratic:(list::1 _2 1)

"quadratic : (list :: <a> <b> <c>)"
(  ((d#)=0&)->((string::'x = ')++str°p1#);
((d#)>0&)->((string::'x1 = ')++(str°(p1#)+p2#)
++(string::'; x2 = ')++str°(p1#)-p2#);
(string::'x1 = (')++(str°p1#)++(string::', ')++(str°p2#)
++(string::'); x2 = (')++(str°p1#)++(string::', ')++(str°neg°p2#)++(string::')')
) ° (p1#=neg°(b#)/((2&)*a#))
° (p2#=(sqrt°abs°d#)/((2&)*a#))
° d#=((b#)*b#)-(4&)*(a#)*c#
)<-a b c

sqrt==id^0.5&
abs==(id<0&)->neg;id