The latest Cat version introduces a significant new change: stack
state descriptors now describe the stack reading left to right, where
the left most element is the top of the stack. The documentation
doesn't reflect this yet, except for the documentation on primitives
(http://www.cat-language.com/primitives.html).
A subtle but important new addition is the inclusion of linear
recursion combinator, which allows you to write recursive functions.
The Cat type inference algorithm currently can't handle
self-referential functions, but you implement recursive algorithms
using "rec".
Here is an example of the factorial program:
>> define f { [dup 1 <=] [*] [pop 1] [dup --] rec }
inferred type for program 'f' as ( int ) -> ( int )
main stack: _empty_
>> 5 f
main stack: 120
>> 6 f
main stack: 120 720
The type of the rec combinator is interesting (at least I thought so):
(
(A:any*)->(A A) // argument relation
(A)->(B:any*) // on termination
(A B)->(B) // result relation
(A)->(bool A) // termination condition
A // input
)->(B)
That's it for now, more to come soon.
Christopher