[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rec definition



I know that rec was eliminated in R^3RS, but I'm curious about it's definition
in schemes where it exists.

TI PC Scheme macroexpands (rec var val) to (letrec ((var val)) var), in
compliance with R^2RS and it's own manual *provided val isn't a lambda
expression*.  On the other hand, it macroexpands (rec var (lambda argl body))
into (letrec ((var (lambda argl body))) (lambda argl (var . argl))).

The question is: why?  It can't be a bug, as it's a special case where there
is no need for one.  But I don't understand, on the other hand, what it is
intended to achieve.

If someone from TI is on the list, I'd be grateful for the real answer.
However, I'd settle for some informed speculation from others familiar
with implementations and uses of rec.  Do any other schemes implement
rec this way?  Is there any programming paradigm it makes work where the
simple definition doesn't?  (I know of one example of the reverse.)  Is
it easier to compile the fancier version into efficient code in some cases
for some reason?

Thanks.
-------