From: Mark H Weaver <mhw@netris.org>
To: 17296-done@debbugs.gnu.org
Subject: bug#17296: [PATCH] SRFI-1 'length+' raises an error unless passed a proper or circular list
Date: Sun, 01 Jun 2014 20:56:21 -0400 [thread overview]
Message-ID: <87bnuc2kp6.fsf@yeeloong.lan> (raw)
In-Reply-To: <878ur25thj.fsf@yeeloong.lan> (Mark H. Weaver's message of "Fri, 18 Apr 2014 15:26:48 -0400")
Mark H Weaver <mhw@netris.org> writes:
> According to the SRFI-1 spec, 'length+' must be passed a proper or
> circular list. It should raise an error when passed a non-pair or an
> improper list, but instead it returns #f in such cases:
>
> scheme@(guile-user)> (use-modules (srfi srfi-1))
> scheme@(guile-user)> (length+ 5)
> $1 = #f
> scheme@(guile-user)> (length+ 'x)
> $2 = #f
> scheme@(guile-user)> (length+ '(x . y))
> $3 = #f
>
> One side effect of this is that SRFI-1 'map', which uses 'length+' to
> validate the arguments and find the shortest length, accepts improper
> lists and non-pairs as arguments as long as one of the arguments is a
> proper list:
>
> scheme@(guile-user)> (map + '(1 2) '(1 2 3 . 4))
> $4 = (2 4)
> scheme@(guile-user)> (map + '() 2)
> $5 = ()
> scheme@(guile-user)> (map + '(1) 2)
> ERROR: In procedure cdr:
> ERROR: In procedure cdr: Wrong type (expecting pair): 2
>
> The attached patch fixes these problems.
Pushed to stable-2.0, commit a5186f506f69ef8a8accd234ca434efd13f302c9.
I'm closing this bug.
Mark
next prev parent reply other threads:[~2014-06-02 0:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 19:26 bug#17296: [PATCH] SRFI-1 'length+' raises an error unless passed a proper or circular list Mark H Weaver
2014-06-02 0:56 ` Mark H Weaver [this message]
2014-06-03 17:30 ` bug#17296: Uh, wrong? David Kastrup
2014-06-04 2:55 ` Mark H Weaver
2014-06-04 4:39 ` David Kastrup
2014-06-04 14:49 ` Mark H Weaver
2014-09-22 17:34 ` Mark H Weaver
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=87bnuc2kp6.fsf@yeeloong.lan \
--to=mhw@netris.org \
--cc=17296-done@debbugs.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).