core: reverse!: Handle empty list.
* src/mes.c (reverse_x_): Handle empty list. * tests/scm.test ("reverse! ()"): Test it.
This commit is contained in:
parent
dc24a7f76f
commit
41fe739463
|
@ -661,7 +661,7 @@ append_reverse (SCM x, SCM y)
|
|||
SCM
|
||||
reverse_x_ (SCM x, SCM t)
|
||||
{
|
||||
if (TYPE (x) != TPAIR)
|
||||
if (x != cell_nil && TYPE (x) != TPAIR)
|
||||
error (cell_symbol_not_a_pair, cons (x, cell_reverse_x_));
|
||||
SCM r = t;
|
||||
while (x != cell_nil)
|
||||
|
|
|
@ -137,6 +137,9 @@ exit $?
|
|||
(reverse! list)
|
||||
list))
|
||||
|
||||
(pass-if-equal "reverse! ()" '()
|
||||
(reverse! '()))
|
||||
|
||||
(pass-if "cond-expand" (sequal? (cond-expand (foobar #f) (mes (display ": pass: *YAY*") 'mes) (guile (display ": pass: *GUILE*") 'mes)) 'mes))
|
||||
|
||||
(pass-if "apply identity" (seq? (apply identity '(0)) 0))
|
||||
|
|
Loading…
Reference in a new issue