unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.homelinux.net>
To: guile-user@gnu.org
Subject: Re: Multiple values passed as single argument to procedure
Date: Mon, 12 Jun 2017 09:55:55 +0100	[thread overview]
Message-ID: <9b96b4b9-2641-aee0-e6a2-10a3e82d6f3b@ossau.homelinux.net> (raw)
In-Reply-To: <87mv9dy5wb.fsf@gmail.com>

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 ...
         (f)
      ... )

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

   (begin
      ...
      (f))

and

    (if <condition>
        (f))

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	other threads:[~2017-06-12  8:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11  7:56 Multiple values passed as single argument to procedure Chris Marusich
2017-06-11  8:28 ` David Kastrup
2017-06-11 20:36 ` Mark H Weaver
2017-06-11 21:31   ` Mark H Weaver
2017-06-12  0:19   ` Chris Marusich
2017-06-12  4:25     ` Mark H Weaver
2017-06-12  8:19       ` Chris Marusich
2017-06-12  8:55         ` Neil Jerram [this message]
2017-06-12  9:48           ` Neil Jerram
2017-06-12  9:39         ` David Kastrup
2017-06-12 11:31           ` Mark H Weaver
2017-06-12 14:24             ` David Kastrup
2017-06-13  2:26               ` Mark H Weaver
2017-06-13  3:09                 ` Mark H Weaver
2017-06-13  3:45                 ` Mark H Weaver
2017-06-13 11:17                 ` dsmich
2017-06-26 11:25                   ` Alex Vong
  -- strict thread matches above, loose matches on Subject: below --
2017-09-01 19:39 Chris Marusich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b96b4b9-2641-aee0-e6a2-10a3e82d6f3b@ossau.homelinux.net \
    --to=neil@ossau.homelinux.net \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).