[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Expanding ellipsis on lists of different length
From: |
Tobia Conforto |
Subject: |
Re: [Chicken-users] Expanding ellipsis on lists of different length |
Date: |
Thu, 28 Aug 2008 16:20:59 +0200 |
felix winkelmann wrote:
alexpander accepts this form, but gives an error if the lists are of
unequal length.
I believe this is the correct behaviour. Chicken gives an error only
when the first list is longer than the second, not when it's shorter.
Elf wrote:
the untest case is always valid, the test case is only valid when
input is of the same length.
Yes, that's my point.
i am confused. are you proposing that it should always signal an
error when getting the split ellipses like this, or when the lists
are mismatched? (the second case is a bit unpleasant to try to catch
all the time, and would probably have performance unplesantnesses.)
It should signal an error when they are mismatched.
I believe it's only a matter of using a version of map that checks
this condition: that all its arguments become '() at the same time.
Maybe it would be useful to modify map itself in this way?
;; correct, this is an error
(map list '(1 2 3) '(10 20))
=> Error: (map) lists are not of same length: (())
;; not so correct, this should be an error too
(map list '(1 2) '(10 20 30))
=> ((1 10) (2 20))
Tobia