Subject: Re: bug#17296: [PATCH] SRFI-1 'length+' raises an error unless passed a proper or circular list

From: Mark H Weaver <[email-masked]>
Date: Sun, 01 Jun 2014 20:56:21 -0400

Mark H Weaver <[email-masked]> 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