# FPr

Implementation of programming language FPr

Implementation is Version FPr 2010.

## 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
``````