I used to write commands like Java and C #.Programming LanguageOfProgramAre you interested in trying the functional programming language on this. NET platform?
Cat language is a stack-based functional language that can run on. NET and mono platforms. Its Interpreter is written in C,
TotalCodeThe amount is about 15 K. You can try to analyze the code. Maybe you will have a deep understanding of the principles of functional programming.
To put it bluntly, describe the function language's Fibonacci first.
Define fib (N)
{N 1 <= [N] [n 1-fib N 2-fib +] If}
Is this tianshu?
Calm down and analyze it carefully:
Stack-based expressions should be post-order expressions, which are analyzed step by step:
N 1 <= Limit n <= 1
N 1 <= [N] returns n when limit n <= 1
N 1 <= [N] [n 1-fib N 2-fib +] If, can be interpreted:
If n <= 1
Returns n
Else
Returns n 1-fib N 2-fib +
N 1-fib N 2-fib + is fib (n-1) + fib (n-2 ).
Well, the entire expression is converted to an imperative programming language like this:
Int FIB ( Int N)
{
If (N <= 1 )
Return 1 ;
Else
Return FIB (n - 1 ) + FIB (n - 2 );
}
The difference between one line of code and four lines of code is so big.
Please try it at http://code.google.com/p/cat-language /.
The last one is my: