From: David Kastrup <dak@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: Dotted pair call argument
Date: Tue, 21 Feb 2012 19:05:11 +0100 [thread overview]
Message-ID: <8762f0cbag.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <8762f014ob.fsf@netris.org> (Mark H. Weaver's message of "Tue, 21 Feb 2012 12:23:32 -0500")
Mark H Weaver <mhw@netris.org> writes:
> David Kastrup <dak@gnu.org> writes:
>>
>> A list in dotted tail position is evaluated via (map ... eval) rather
>> than (eval ...). I don't see much of a problem with that.
>
> No, it's worse than that. I think you failed to understand my point,
> so let me try again. You propose that (f . x) should be equivalent to
> (apply f x).
When x is not a pair or ().
> Therefore, (f . (g x y)) should also be equivalent to (apply f (g x
> y)).
But (g x y) is a pair.
> To make this more concrete, suppose 'f' is 'vector and 'g' is 'list':
>
> (vector . (list 1 2))
(list 1 2) is a pair (with the car list and the cdr (1 2)).
> If we were to adopt your proposal, users would naturally expect this to
> evaluate to #(1 2). However, the evaluator sees (vector list 1 2) and
> thus produces a vector of three elements: #(#<procedure list _> 1 2).
Sure.
> In summary, your proposed syntax could only be detected if the dotted
> tail happened to be an atom.
() is an atom, but it is already treated differently.
> Scheme has a very useful property which your proposed syntax would
> destroy: any valid expression can be substituted for any other valid
> expression, and the result has the same meaning except for the
> substitution.
guile> (display . (close (current-output-port)))
#<primitive-procedure close>guile>
Now try
(define x (close (current-output-port)))
(display . x)
Good luck. The context already decides what a valid expression is. Not
everything looking like one is treated like one.
--
David Kastrup
next prev parent reply other threads:[~2012-02-21 18:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 14:03 Dotted pair call argument David Kastrup
2012-02-21 15:36 ` Mark H Weaver
2012-02-21 15:59 ` David Kastrup
2012-02-21 16:05 ` David Kastrup
2012-02-21 17:23 ` Mark H Weaver
2012-02-21 18:05 ` David Kastrup [this message]
2012-02-22 0:41 ` Mark H Weaver
2012-02-22 9:06 ` David Kastrup
2012-02-21 20:31 ` Neil Jerram
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=8762f0cbag.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.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).