Re: [Chicken-users] Expanding ellipsis on lists of different length
On Thu, 28 Aug 2008, Tobia Conforto wrote: 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)) this is a problem, because this technically is correct behaviour, if we're going to allow this (what i consider broken but understand from my betters is merely unspecified) behaviour. it is consuming all of the tokens from the list. yay ambiguity. i dont think that trying to solve the case in the general form by the extra checks would be a good idea because a) most forms will be correct in more than an unspecified sense, and b) the vast majority of forms would get a fairly nasty slowdown in order to error for something outside the spec. -elf ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Expanding ellipsis on lists of different length
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 ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Expanding ellipsis on lists of different length
On Wed, Aug 27, 2008 at 9:02 PM, Elf <[EMAIL PROTECTED]> wrote: > > i believe that this is an error in chicken. there are two ellipses in the > pattern and only one in the output spec, so in both cases it should error > with > an invalid transformer spec notice. additionally, the 'a' isnt followed by > an ellipsis, nor is the 'b' followed by an ellipsis, which is specifically > the error referred to here: 'pattern variables that occur in subpatterns > followed by one or more instances of the identifier ... are allowed only in > subtemplates that are followed by as many instances of ... . > they are replaced in the output by all of the subforms they match in the > input, > distributed as indicated. it is an error if the output cannot be built as > specified.' > BTW, alexpander accepts this form, but gives an error if the lists are of unequal length. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users