Concatenative topics
Concatenative meta
Other languages
Meta
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 allows the infix notation which is mostly right-associative.
A table is a linear arrangement of key-value pairs similar to a linked list.
( value0 key0 value1 key1 value2 key2 ... ... valuen keyn )
An instance variable can then access a certain key and pick out the associated value.
#key1 : (value0 key0 value1 key1 value2 key2 ... ... valuen keyn) --> value1
In the original FP by John Backus, it was only possible to access values in a sequence using numbers as selectors. This is still possible via integer numbers[2] on the values in the table.
[2] : (value0 key0 value1 key1 value2 key2 ... ... valuen keyn) --> value2
So you can define a function that adds three numbers.
triadd == (#a + #b + #c) <- a;b;c; triadd ° 10,20,30, --> 60
more code examples
This revision created on Fri, 19 Jul 2024 21:48:37 by fpstefan (update)