David Kastrup <d...@gnu.org> writes:

> Mark H Weaver <m...@netris.org> writes:
>
>> David Kastrup <d...@gnu.org> writes:
>>> I guess my "real" problem is that I'd like to do call wrapping by writing
>>>
>>> (lambda ( . x) (fun . x))
>>>
>>> instead of having to write
>>>
>>> (lambda ( . x) (apply fun x))
>>>
>>> I assume eval is not supposed to try dealing with dotted lists?
>>
>> The problem is that (f . (g x y)) is equivalent to (f g x y).
>> Therefore, while Scheme could in theory support procedure calls with a
>> dotted tail that happened to be an atom, it would do something rather
>> different and confusing if the dotted tail was itself a procedure/macro
>> call.
>
> A list in dotted tail position is evaluated via (map ... eval) rather
> than (eval ...).  I don't see much of a problem with that.
>
> It works fine for () as one can see:
> guile> (+ . ())
> 0
> guile> 
>
> So why not for others?

I'll answer this a bit myself.  Well, it does work for other lists.
Cough, cough.  The question is why it doesn't for non-lists.
If (f . x) was supposed to be equivalent to (apply f x), then x would
need to be evaluated.  In (+ . ()), () itself is _not_ being evaluated.
So this would be new behavior, and at least different from that of the
non-pair ().

I'm still not convinced that it would be a bad idea...

-- 
David Kastrup


Reply via email to