FP trivia

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

is a point-free programming language with instance variables

FP trivia is a pure functional programming language inspired by the FP-Systems of John Backus, APL, Smalltalk and Lisp. It is intended to remedy the problematic fact that FP[1] is viewed as free of variables, which is also true in terms of lambda variables, but not in terms of the instance variables that are used by FP trivia. The main data type is therefore a table that the instance variables can access and also allowes the infix notation which is mostly right-associative.

Elements of syntax:

Inline comments // text
Case-sensitivity yes
Variable identifier regexp #name
Function identifier regexp abc or +-*/
Variable assignment name := term
Variable declaration with assignment func <- name1 ; name2 ; ... ; namen ;
Grouping expressions ( ... ... )
Block ( ... ... )
Physical (shallow) equality =
Physical (shallow) inequality <> or !=
Comparison < > <= >=
Function definition ident == term
Function call func o arg1 , arg2 , ... , argn ,
Function call with no parameters func
Sequence func1 o func2 o ... o funcn
If - then - else test -> then | else
While condition do test ->* body
Do until condition body loopif not o test
For each value in a numeric range, 1 increment (func do) o num1 , num2 ,
For each value in a numeric range, 1 decrement (func do) o num2 , num1 , _1 ,

FP trivia idents dump
FP trivia idents dump

Example with instance variables
Example with instance variables



Example for versions FP trivia 20210108

This example provides a list of factorials from 0 up to 16. Factorial for a non-recursive / recursive version.

Factorial non-recursive
Factorial non-recursive

Factorial recursive
Factorial recursive

Factorial with Y combinator
Factorial with Y combinator

Factorial with while- and for-do-loop
Factorial with while- and for-do-loop