diff options
author | Kevin Ryde <user42@zip.com.au> | 2005-05-03 23:24:31 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2005-05-03 23:24:31 +0000 |
commit | 03731332d5dc8d650b947f5126427402c2b1d8bb (patch) | |
tree | a85eb956a485990b40a6bfde9f5a0f7a829e712c /srfi | |
parent | b2c82c27f085159e702330e6d277fc0ad8eccfdb (diff) | |
download | guile-03731332d5dc8d650b947f5126427402c2b1d8bb.tar.gz |
(fifth, sixth, seventh, eighth, ninth, tenth): Rewrite in C.
Diffstat (limited to 'srfi')
-rw-r--r-- | srfi/srfi-1.c | 61 | ||||
-rw-r--r-- | srfi/srfi-1.h | 6 | ||||
-rw-r--r-- | srfi/srfi-1.scm | 6 |
3 files changed, 67 insertions, 6 deletions
diff --git a/srfi/srfi-1.c b/srfi/srfi-1.c index 6c1da2d7b..a746732a4 100644 --- a/srfi/srfi-1.c +++ b/srfi/srfi-1.c @@ -674,6 +674,26 @@ SCM_DEFINE (scm_srfi1_drop_while, "drop-while", 2, 0, 0, #undef FUNC_NAME +SCM_DEFINE (scm_srfi1_eighth, "eighth", 1, 0, 0, + (SCM lst), + "Return the eighth element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_eighth +{ + return scm_list_ref (lst, SCM_I_MAKINUM (7)); +} +#undef FUNC_NAME + + +SCM_DEFINE (scm_srfi1_fifth, "fifth", 1, 0, 0, + (SCM lst), + "Return the fifth element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_fifth +{ + return scm_list_ref (lst, SCM_I_MAKINUM (4)); +} +#undef FUNC_NAME + + SCM_DEFINE (scm_srfi1_filter_map, "filter-map", 2, 0, 1, (SCM proc, SCM list1, SCM rest), "Apply @var{proc} to to the elements of @var{list1} @dots{} and\n" @@ -1188,6 +1208,17 @@ SCM_DEFINE (scm_srfi1_assoc, "assoc", 2, 1, 0, } #undef FUNC_NAME + +SCM_DEFINE (scm_srfi1_ninth, "ninth", 1, 0, 0, + (SCM lst), + "Return the ninth element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_ninth +{ + return scm_list_ref (lst, SCM_I_MAKINUM (8)); +} +#undef FUNC_NAME + + SCM_DEFINE (scm_srfi1_partition, "partition", 2, 0, 0, (SCM pred, SCM list), "Partition the elements of @var{list} with predicate @var{pred}.\n" @@ -1474,6 +1505,26 @@ SCM_DEFINE (scm_srfi1_remove_x, "remove!", 2, 0, 0, #undef FUNC_NAME +SCM_DEFINE (scm_srfi1_seventh, "seventh", 1, 0, 0, + (SCM lst), + "Return the seventh element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_seventh +{ + return scm_list_ref (lst, SCM_I_MAKINUM (6)); +} +#undef FUNC_NAME + + +SCM_DEFINE (scm_srfi1_sixth, "sixth", 1, 0, 0, + (SCM lst), + "Return the sixth element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_sixth +{ + return scm_list_ref (lst, SCM_I_MAKINUM (5)); +} +#undef FUNC_NAME + + SCM_DEFINE (scm_srfi1_span, "span", 2, 0, 0, (SCM pred, SCM lst), "Return two values, the longest initial prefix of @var{lst}\n" @@ -1699,6 +1750,16 @@ SCM_DEFINE (scm_srfi1_take_while_x, "take-while!", 2, 0, 0, #undef FUNC_NAME +SCM_DEFINE (scm_srfi1_tenth, "tenth", 1, 0, 0, + (SCM lst), + "Return the tenth element of @var{lst}.") +#define FUNC_NAME s_scm_srfi1_tenth +{ + return scm_list_ref (lst, SCM_I_MAKINUM (9)); +} +#undef FUNC_NAME + + void scm_init_srfi_1 (void) { diff --git a/srfi/srfi-1.h b/srfi/srfi-1.h index 83f3da65f..3f8f81e8b 100644 --- a/srfi/srfi-1.h +++ b/srfi/srfi-1.h @@ -45,6 +45,8 @@ SCM_SRFI1_API SCM scm_srfi1_delete_duplicates_x (SCM lst, SCM pred); SCM_SRFI1_API SCM scm_srfi1_drop_right (SCM lst, SCM n); SCM_SRFI1_API SCM scm_srfi1_drop_right_x (SCM lst, SCM n); SCM_SRFI1_API SCM scm_srfi1_drop_while (SCM pred, SCM lst); +SCM_SRFI1_API SCM scm_srfi1_eighth (SCM lst); +SCM_SRFI1_API SCM scm_srfi1_fifth (SCM lst); SCM_SRFI1_API SCM scm_srfi1_filter_map (SCM proc, SCM list1, SCM rest); SCM_SRFI1_API SCM scm_srfi1_find (SCM pred, SCM lst); SCM_SRFI1_API SCM scm_srfi1_find_tail (SCM pred, SCM lst); @@ -54,6 +56,7 @@ SCM_SRFI1_API SCM scm_srfi1_list_copy (SCM lst); SCM_SRFI1_API SCM scm_srfi1_map (SCM proc, SCM arg1, SCM args); SCM_SRFI1_API SCM scm_srfi1_for_each (SCM proc, SCM arg1, SCM args); SCM_SRFI1_API SCM scm_srfi1_member (SCM obj, SCM ls, SCM pred); +SCM_SRFI1_API SCM scm_srfi1_ninth (SCM lst); SCM_SRFI1_API SCM scm_srfi1_assoc (SCM key, SCM alist, SCM pred); SCM_SRFI1_API SCM scm_srfi1_partition (SCM pred, SCM list); SCM_SRFI1_API SCM scm_srfi1_partition_x (SCM pred, SCM list); @@ -61,6 +64,8 @@ SCM_SRFI1_API SCM scm_srfi1_reduce (SCM proc, SCM def, SCM lst); SCM_SRFI1_API SCM scm_srfi1_reduce_right (SCM proc, SCM def, SCM lst); SCM_SRFI1_API SCM scm_srfi1_remove (SCM pred, SCM list); SCM_SRFI1_API SCM scm_srfi1_remove_x (SCM pred, SCM list); +SCM_SRFI1_API SCM scm_srfi1_seventh (SCM lst); +SCM_SRFI1_API SCM scm_srfi1_sixth (SCM lst); SCM_SRFI1_API SCM scm_srfi1_span (SCM pred, SCM lst); SCM_SRFI1_API SCM scm_srfi1_span_x (SCM pred, SCM lst); SCM_SRFI1_API SCM scm_srfi1_split_at (SCM lst, SCM n); @@ -69,6 +74,7 @@ SCM_SRFI1_API SCM scm_srfi1_take_x (SCM lst, SCM n); SCM_SRFI1_API SCM scm_srfi1_take_right (SCM lst, SCM n); SCM_SRFI1_API SCM scm_srfi1_take_while (SCM pred, SCM lst); SCM_SRFI1_API SCM scm_srfi1_take_while_x (SCM pred, SCM lst); +SCM_SRFI1_API SCM scm_srfi1_tenth (SCM lst); SCM_SRFI1_API void scm_init_srfi_1 (void); diff --git a/srfi/srfi-1.scm b/srfi/srfi-1.scm index 7e1fcf493..36da13b75 100644 --- a/srfi/srfi-1.scm +++ b/srfi/srfi-1.scm @@ -329,12 +329,6 @@ (define second cadr) (define third caddr) (define fourth cadddr) -(define (fifth x) (car (cddddr x))) -(define (sixth x) (cadr (cddddr x))) -(define (seventh x) (caddr (cddddr x))) -(define (eighth x) (cadddr (cddddr x))) -(define (ninth x) (car (cddddr (cddddr x)))) -(define (tenth x) (cadr (cddddr (cddddr x)))) (define (car+cdr x) (values (car x) (cdr x))) |