86 |
#include "libguile/feature.h" |
#include "libguile/feature.h" |
87 |
#include "libguile/root.h" |
#include "libguile/root.h" |
88 |
#include "libguile/vectors.h" |
#include "libguile/vectors.h" |
89 |
|
#include "libguile/lang.h" |
90 |
|
|
91 |
#include "libguile/validate.h" |
#include "libguile/validate.h" |
92 |
#include "libguile/sort.h" |
#include "libguile/sort.h" |
458 |
SCM *vp; |
SCM *vp; |
459 |
cmp_fun_t cmp = scm_cmp_function (less); |
cmp_fun_t cmp = scm_cmp_function (less); |
460 |
|
|
461 |
if (SCM_NULLP (items)) |
if (SCM_NULL_OR_NIL_P (items)) |
462 |
return SCM_BOOL_T; |
return SCM_BOOL_T; |
463 |
|
|
464 |
SCM_VALIDATE_NIM (2,less); |
SCM_VALIDATE_NIM (2,less); |
531 |
cmp_fun_t cmp = scm_cmp_function (less); |
cmp_fun_t cmp = scm_cmp_function (less); |
532 |
SCM_VALIDATE_NIM (3,less); |
SCM_VALIDATE_NIM (3,less); |
533 |
|
|
534 |
if (SCM_NULLP (alist)) |
if (SCM_NULL_OR_NIL_P (alist)) |
535 |
return blist; |
return blist; |
536 |
else if (SCM_NULLP (blist)) |
else if (SCM_NULL_OR_NIL_P (blist)) |
537 |
return alist; |
return alist; |
538 |
else |
else |
539 |
{ |
{ |
585 |
{ |
{ |
586 |
SCM build, last; |
SCM build, last; |
587 |
|
|
588 |
if (SCM_NULLP (alist)) |
if (SCM_NULL_OR_NIL_P (alist)) |
589 |
return blist; |
return blist; |
590 |
else if (SCM_NULLP (blist)) |
else if (SCM_NULL_OR_NIL_P (blist)) |
591 |
return alist; |
return alist; |
592 |
else |
else |
593 |
{ |
{ |
642 |
long alen, blen; /* list lengths */ |
long alen, blen; /* list lengths */ |
643 |
|
|
644 |
SCM_VALIDATE_NIM (3,less); |
SCM_VALIDATE_NIM (3,less); |
645 |
if (SCM_NULLP (alist)) |
if (SCM_NULL_OR_NIL_P (alist)) |
646 |
return blist; |
return blist; |
647 |
else if (SCM_NULLP (blist)) |
else if (SCM_NULL_OR_NIL_P (blist)) |
648 |
return alist; |
return alist; |
649 |
else |
else |
650 |
{ |
{ |
716 |
#define FUNC_NAME s_scm_sort_x |
#define FUNC_NAME s_scm_sort_x |
717 |
{ |
{ |
718 |
long len; /* list/vector length */ |
long len; /* list/vector length */ |
719 |
if (SCM_NULLP(items)) |
if (SCM_NULL_OR_NIL_P (items)) |
720 |
return SCM_EOL; |
return items; |
721 |
|
|
722 |
SCM_VALIDATE_NIM (2,less); |
SCM_VALIDATE_NIM (2,less); |
723 |
|
|
749 |
"elements. This is not a stable sort.") |
"elements. This is not a stable sort.") |
750 |
#define FUNC_NAME s_scm_sort |
#define FUNC_NAME s_scm_sort |
751 |
{ |
{ |
752 |
if (SCM_NULLP(items)) |
if (SCM_NULL_OR_NIL_P (items)) |
753 |
return SCM_EOL; |
return items; |
754 |
|
|
755 |
SCM_VALIDATE_NIM (2,less); |
SCM_VALIDATE_NIM (2,less); |
756 |
if (SCM_CONSP (items)) |
if (SCM_CONSP (items)) |
847 |
{ |
{ |
848 |
long len; /* list/vector length */ |
long len; /* list/vector length */ |
849 |
|
|
850 |
if (SCM_NULLP (items)) |
if (SCM_NULL_OR_NIL_P (items)) |
851 |
return SCM_EOL; |
return items; |
852 |
|
|
853 |
SCM_VALIDATE_NIM (2,less); |
SCM_VALIDATE_NIM (2,less); |
854 |
if (SCM_CONSP (items)) |
if (SCM_CONSP (items)) |
886 |
#define FUNC_NAME s_scm_stable_sort |
#define FUNC_NAME s_scm_stable_sort |
887 |
{ |
{ |
888 |
long len; /* list/vector length */ |
long len; /* list/vector length */ |
889 |
if (SCM_NULLP (items)) |
if (SCM_NULL_OR_NIL_P (items)) |
890 |
return SCM_EOL; |
return items; |
891 |
|
|
892 |
SCM_VALIDATE_NIM (2,less); |
SCM_VALIDATE_NIM (2,less); |
893 |
if (SCM_CONSP (items)) |
if (SCM_CONSP (items)) |