From: Mark H Weaver <mhw@netris.org>
To: Alex Shinn <alexshinn@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: Why not support (begin), (cond), (case-lambda), etc?
Date: Fri, 06 Jan 2012 12:11:12 -0500 [thread overview]
Message-ID: <87boqgbvtb.fsf@netris.org> (raw)
In-Reply-To: <CAMMPzYMcr3saosOO9q_4wpfJrmf97ZLddNyohFPsE-WRDdnGxA@mail.gmail.com> (Alex Shinn's message of "Fri, 6 Jan 2012 21:08:57 +0900")
Alex Shinn <alexshinn@gmail.com> writes:
>> Of course, it is not hard to work around these seemingly pointless
>> prohibitions, just as it would not be hard to write
>>
>> (if (null? xs) 0 (apply + xs))
>>
>> instead of
>>
>> (apply + xs)
>>
>> but I don't understand why we should have to. What's the compelling
>> argument on the other side that justifies these annoyances?
>
> This analogy is meaningless, but for the record
> you should be using fold or reduce here.
Yes, I'm aware that using `fold' or `reduce' is more robust for large
lists. You could just as easily correct anyone who uses alists in a
simple example and say "for the record you should be using a balanced
tree instead."
Or perhaps you're advocating (reduce + 0 xs) over (apply + xs) as a
matter of style. If so, I happen to agree with you, but that's not the
point. The point is, (apply + xs) is a sensible thing for someone to do
if xs is not huge, and it's good that Scheme treats this degenerate case
properly.
Similarly, if we are generating a sequence of expressions to be
evaluated for effects only, then an empty sequence has a perfectly
logical and obvious meaning.
Thanks,
Mark
next prev parent reply other threads:[~2012-01-06 17:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 0:49 Why not support (begin), (cond), (case-lambda), etc? Mark H Weaver
2012-01-06 3:37 ` Alex Shinn
2012-01-06 5:03 ` Mark H Weaver
2012-01-06 6:08 ` Alex Shinn
2012-01-06 8:03 ` Mark H Weaver
2012-01-06 12:08 ` Alex Shinn
2012-01-06 12:26 ` David Kastrup
2012-01-06 12:38 ` Alex Shinn
2012-01-06 12:50 ` David Kastrup
2012-01-06 12:52 ` Alex Shinn
2012-01-06 13:02 ` David Kastrup
2012-01-06 16:13 ` Andy Wingo
2012-01-06 16:19 ` David Kastrup
2012-01-06 17:23 ` Andy Wingo
2012-01-06 17:11 ` Mark H Weaver [this message]
2012-05-01 14:10 ` Who moderates the scheme-reports list? Mark H Weaver
2012-05-05 5:09 ` Alex Shinn
2012-05-06 3:36 ` Mark H Weaver
2012-05-06 3:47 ` Alex Shinn
2012-05-06 10:12 ` David Kastrup
2012-05-07 16:26 ` Ludovic Courtès
2012-05-07 17:36 ` Mark H Weaver
2012-05-07 22:06 ` Alex Shinn
2012-05-08 14:42 ` Ludovic Courtès
2012-01-06 9:48 ` Why not support (begin), (cond), (case-lambda), etc? David Kastrup
2012-01-06 9:46 ` David Kastrup
2012-01-06 16:48 ` Mark H Weaver
2012-01-06 17:02 ` David Kastrup
2012-01-06 16:53 ` Ian Price
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=87boqgbvtb.fsf@netris.org \
--to=mhw@netris.org \
--cc=alexshinn@gmail.com \
--cc=guile-devel@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).