qznc:

http://rosettacode.org/wiki/Look-and-say_sequence#D

The fast version is nearly functional, too. Since memory management is not considered a side effect there is only the printfs. If the printfs are wrapped into "debug", the function is pure.

In a system that allows you a more fine-graded management of effects through an algebra, memory allocation is an effect. It's easy to show D functions annotated with "pure" that aren't pure at all because of memory allocation.

Bye,
bearophile

Reply via email to