Brainf with functions
Jump to navigation
Jump to search
BF commands are same, but I added two.
:
This defines a function. The symbol before it is the command that calls the function anywhere after the function, and ; closes it.
Examples
Cat
n:,.;+[n]
HIWORLD
o:++++++++; c:[<+>-]<; f:+++++++[>o++<-]>c; f>f>f>f>f>f>f<<<<<<++.>+++.>oo+.>o+.>o++++.>++++++.>--.
Truth-Machine
A truth-machine implementation, ostended with a concomitant endeictic purpose concerning functions, is presented below:
A:++++++++; B:++++++; R:[-]; C:R>RA[<B>-]<; C >, <[>-<-]> [>C+.R<] C.
The following variant of the truth-machine relies on a function's conditional redefinition, in this case the P specimen, in order to either issue a single “0” or an olamic “1” output:
A:++++++++; B:++++++; R:[-]; C:R>RA[<B>-]<; C >, <[>-<-]> P:C.; [P:+[>C+.R<];-] P
Interpreter
- Common Lisp implementation of the Brainf with functions programming language.