mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
spelling fix
This commit is contained in:
parent
6d6e18a918
commit
448a3bc269
1 changed files with 6 additions and 6 deletions
|
@ -118,7 +118,7 @@ scm_list_p(x)
|
||||||
|
|
||||||
|
|
||||||
/* Return the length of SX, or -1 if it's not a proper list.
|
/* Return the length of SX, or -1 if it's not a proper list.
|
||||||
This uses the "tortise and hare" algorithm to detect "infinitely
|
This uses the "tortoise and hare" algorithm to detect "infinitely
|
||||||
long" lists (i.e. lists with cycles in their cdrs), and returns -1
|
long" lists (i.e. lists with cycles in their cdrs), and returns -1
|
||||||
if it does find one. */
|
if it does find one. */
|
||||||
long
|
long
|
||||||
|
@ -126,7 +126,7 @@ scm_ilength(sx)
|
||||||
SCM sx;
|
SCM sx;
|
||||||
{
|
{
|
||||||
register long i = 0;
|
register long i = 0;
|
||||||
register SCM tortise = sx;
|
register SCM tortoise = sx;
|
||||||
register SCM hare = sx;
|
register SCM hare = sx;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -138,12 +138,12 @@ scm_ilength(sx)
|
||||||
if SCM_NCONSP(hare) return -1;
|
if SCM_NCONSP(hare) return -1;
|
||||||
hare = SCM_CDR(hare);
|
hare = SCM_CDR(hare);
|
||||||
i++;
|
i++;
|
||||||
/* For every two steps the hare takes, the tortise takes one. */
|
/* For every two steps the hare takes, the tortoise takes one. */
|
||||||
tortise = SCM_CDR(tortise);
|
tortoise = SCM_CDR(tortoise);
|
||||||
}
|
}
|
||||||
while (hare != tortise);
|
while (hare != tortoise);
|
||||||
|
|
||||||
/* If the tortise ever catches the hare, then the list must contain
|
/* If the tortoise ever catches the hare, then the list must contain
|
||||||
a cycle. */
|
a cycle. */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue