chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] for-each and mismatching list lengths


From: Christian Kellermann
Subject: Re: [Chicken-users] for-each and mismatching list lengths
Date: Tue, 20 Sep 2011 12:22:27 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

* Sascha Ziemann <address@hidden> [110920 12:17]:
> This throws an error:
> 
> (for-each (lambda (a b)
>             (printf "~s ~s\n" a b))
>           (list 1 2 3 0)
>           (list 4 5 6))
> 
> But this does not:
> 
> (for-each (lambda (a b)
>             (printf "~s ~s\n" a b))
>           (list 1 2 3)
>           (list 4 5 6 0))
> 
> Is this a bug or feature?
> 
> Guile throws out-of-range for both.

R5RS specifies:
If more than one list is given, then they must all be the same length. 

If you give it lists of different lengths, the effect is unspecified.

SRFI-1's map allows this so (use srfi-1) if you need it.

Cheers,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]