1 /* Copyright (C) 1995,1996,1997, 2000, 2001, 2004 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 /* list manipulation */
21 #include "libguile/gh.h"
23 #if SCM_ENABLE_DEPRECATED
25 /* returns the length of a list */
29 return gh_scm2ulong (scm_length (l
));
34 /* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */
36 /* gh_append() takes a args, which is a list of lists, and appends
37 them all together into a single list, which is returned. This is
38 equivalent to the Scheme procedure (append list1 list2 ...) */
42 return scm_append (args
);
46 gh_append2 (SCM l1
, SCM l2
)
48 return scm_append (scm_list_2 (l1
, l2
));
52 gh_append3(SCM l1
, SCM l2
, SCM l3
)
54 return scm_append (scm_list_3 (l1
, l2
, l3
));
58 gh_append4 (SCM l1
, SCM l2
, SCM l3
, SCM l4
)
60 return scm_append (scm_list_4 (l1
, l2
, l3
, l4
));
63 /* gh_reverse() is defined as a macro in gh.h */
64 /* gh_list_tail() is defined as a macro in gh.h */
65 /* gh_list_ref() is defined as a macro in gh.h */
66 /* gh_memq() is defined as a macro in gh.h */
67 /* gh_memv() is defined as a macro in gh.h */
68 /* gh_member() is defined as a macro in gh.h */
69 /* gh_assq() is defined as a macro in gh.h */
70 /* gh_assv() is defined as a macro in gh.h */
71 /* gh_assoc() is defined as a macro in gh.h */
73 /* analogous to the Scheme cons operator */
75 gh_cons (SCM x
, SCM y
)
77 return scm_cons (x
, y
);
80 /* analogous to the Scheme car operator */
87 /* analogous to the Scheme cdr operator */
94 /* now for the multiple car/cdr utility procedures */
119 return scm_caaar (x
);
124 return scm_caadr (x
);
129 return scm_cadar (x
);
134 return scm_caddr (x
);
139 return scm_cdaar (x
);
144 return scm_cdadr (x
);
149 return scm_cddar (x
);
154 return scm_cdddr (x
);
157 /* equivalent to (set-car! pair value) */
159 gh_set_car_x(SCM pair
, SCM value
)
161 return scm_set_car_x(pair
, value
);
164 /* equivalent to (set-cdr! pair value) */
166 gh_set_cdr_x(SCM pair
, SCM value
)
168 return scm_set_cdr_x(pair
, value
);
171 #endif /* SCM_ENABLE_DEPRECATED */