[Nickle] Mutual tail-recursion

Michel Salim michel.salim at gmail.com
Sat Feb 18 21:33:54 PST 2006


I just learned of Nickle's existence earlier today (thanks to a
reference by Lambda-the-Ultimate user po8, real identity unknown,
though he seems to be involved here), and I'm finding it quite
interesting (being able to print function definitions is really nice
for prototyping and learning APIs)

As per my standard practice when trying out languages with functional
programming features, I subjected Nickle to recursively testing

/* there's probably a better way to forward-declare a function */
oddp = bool func(int n) { return false;};
evenp = bool func (int n) { if (0==n) return true; else return oddp(n-1); };
oddp = bool func (int n) { if (0==n) return false; else return evenp(n-1); };

Doing this in GCC, if I remember correctly, results in a stack
overflow at n ~= 140000, unless sibling-call optimization is turned
on. Nickle surprisingly managed to compute the result of testing n =
10 million, though the memory usage gets disquieting at that point. A
byproduct of the call "stack" actually being heap-allocated to support

My questions are, then:
- Is tail optimization of mutually-recursive functions planned?
- Garbage collecting: after doing evenp(10000000) nickle was consuming
67.3% of 1.4GB of RAM. after about 10 minutes this has only gone down
to 67.0% .. should it be holding on to the memory for that long? Is
there a way to request a collection?

Also, I'll probably propose Nickle for submission to Fedora Extras
(surprisingly, the original RPM spec was written by none other than
Mike Harris, Red Hat's X developer). Is there any runtime dependency
on the header files? I'm currently splitting the header files to a
-devel package.

PS the turtle/snowflake.5c and menace2.5c have their executable bits
incorrectly set.

Best regards,

Michel Salim

More information about the Nickle mailing list