[Top][All Lists]

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

Re: Multiple values passed as single argument to procedure

From: Neil Jerram
Subject: Re: Multiple values passed as single argument to procedure
Date: Mon, 12 Jun 2017 09:55:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 12/06/17 09:19, Chris Marusich wrote:
I think I'm missing something here. In (list (f)), the call to f
certainly looks like it's happening at a position that one might
intuitively call a "tail" position.  So, in this case, what disqualifies
f from being in tail position?  Can you give me an example of a call to
f that would be in tail position, so I can understand the difference?
Sorry if you've already provided such an example; I appreciate your
explanations, and I'm just trying to make sure I fully understand.

Mark will probably have a more precise answer for you, but let me offer my understanding too. In general, in

   ( ... arbitrary code around ...
     ... )

the (f) call is in a tail position if _nothing_ else needs to be done, to the return value(s) of (f), before returning from that block as a whole.

So, common examples of tail position are



   (if <condition>

The case you mentioned, (list (f)), is probably the simplest example of a non-tail position, because something very clearly does need to be done to the return value of (f): it needs to be inserted into a newly allocated list.

Regards - Neil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]