Opened 8 years ago

Closed 8 years ago

#859 closed defect (fixed)

A bug in CL:EVERY with list (rest list).

Reported by: pjb@… Owned by:
Priority: normal Milestone:
Component: IDE Version: 1.6
Keywords: every Cc:

Description

Here is what is expected:

[pjb@kuiper :0 swig]$ clisp -norc -ansi -q [1]> (defun diff1p (lon)

(every (lambda (a b)

(print (list a b (= 1 (- a b)))) (= 1 (- a b)))

lon (rest lon)))

DIFF1P [2]> (diff1p '(6 5 4 3 2 1))

(6 5 T) (5 4 T) (4 3 T) (3 2 T) (2 1 T) T [3]> (quit)

Here is what we get with ccl:

[pjb@kuiper :0 swig]$ ccl -norc Welcome to Clozure Common Lisp Version 1.6-RC1-r14432M (LinuxX8664)! ? (defun diff1p (lon)

(every (lambda (a b)

(print (list a b (= 1 (- a b)))) (= 1 (- a b)))

lon (rest lon)))

DIFF1P ? (diff1p '(6 5 4 3 2 1))

(6 5 T) (4 5 NIL) NIL ? (quit) [pjb@kuiper :0 swig]$ ccl --version Version 1.6-RC1-r14432M (LinuxX8664)

Change History (2)

comment:1 Changed 8 years ago by pjb@…

  • Summary changed from A bug in CL:EVERY with two sequences. to A bug in CL:EVERY with list (rest list).
The same problem occurs with some, notany and notevery, only when the two sequences are related (eg. lon and (rest lon)), and only in this order. 


CL-USER> (every (lambda (a b) (print (list a b))) '(1 2 3 4) '(a b c d))

(1 A) 
(2 B) 
(3 C) 
(4 D) 
T
CL-USER> (let ((lon '(1 2 3 4))) (every (lambda (a b) (print (list a b))) lon (rest lon)))

(1 2) 
(3 2) 
(4 3) 
T
CL-USER> (let ((lon '(1 2 3 4))) (some (lambda (a b) (print (list a b))) lon (rest lon)))

(1 2) 
(1 2)
CL-USER> (let ((lon '(1 2 3 4))) (some (lambda (a b) (print (list a b)) nil) lon (rest lon)))

(1 2) 
(3 2) 
(4 3) 
NIL
CL-USER> (let ((lon '(1 2 3 4))) (notany (lambda (a b) (print (list a b)) nil) lon (rest lon)))

(1 2) 
(3 2) 
(4 3) 
T
CL-USER> (let ((lon '(1 2 3 4))) (notevery (lambda (a b) (print (list a b)) nil) lon (rest lon)))

(1 2) 
T
CL-USER> (let ((lon '(1 2 3 4))) (notevery (lambda (a b) (print (list a b)) t) lon (rest lon)))

(1 2) 
(3 2) 
(4 3) 
NIL
CL-USER> (let ((lon '(1 2 3 4))) (notevery (lambda (a b) (print (list a b)) t) lon '(a b c d)))

(1 A) 
(2 B) 
(3 C) 
(4 D) 
NIL

comment:2 Changed 8 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [14788]) In SOME-XX-MULTI, traverse the list of sequences in a way that doesn't require us to try to find the current sequence via MEMQ; this could affect the wrong sequence if some sequences shared structure (and wasn't the smartest thing to do even if they didn't.) Fixes ticket:859.

Note: See TracTickets for help on using tickets.