1 /* Copyright (C) 1995,1996,1997, 2000, 2001, 2004, 2006, 2008 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
23 /* list manipulation */
25 #include "libguile/gh.h"
27 #if SCM_ENABLE_DEPRECATED
29 /* returns the length of a list */
33 return gh_scm2ulong (scm_length (l));
38 /* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */
40 /* gh_append() takes a args, which is a list of lists, and appends
41 them all together into a single list, which is returned. This is
42 equivalent to the Scheme procedure (append list1 list2 ...) */
46 return scm_append (args);
50 gh_append2 (SCM l1, SCM l2)
52 return scm_append (scm_list_2 (l1, l2));
56 gh_append3(SCM l1, SCM l2, SCM l3)
58 return scm_append (scm_list_3 (l1, l2, l3));
62 gh_append4 (SCM l1, SCM l2, SCM l3, SCM l4)
64 return scm_append (scm_list_4 (l1, l2, l3, l4));
67 /* gh_reverse() is defined as a macro in gh.h */
68 /* gh_list_tail() is defined as a macro in gh.h */
69 /* gh_list_ref() is defined as a macro in gh.h */
70 /* gh_memq() is defined as a macro in gh.h */
71 /* gh_memv() is defined as a macro in gh.h */
72 /* gh_member() is defined as a macro in gh.h */
73 /* gh_assq() is defined as a macro in gh.h */
74 /* gh_assv() is defined as a macro in gh.h */
75 /* gh_assoc() is defined as a macro in gh.h */
77 /* analogous to the Scheme cons operator */
79 gh_cons (SCM x, SCM y)
81 return scm_cons (x, y);
84 /* analogous to the Scheme car operator */
91 /* analogous to the Scheme cdr operator */
98 /* now for the multiple car/cdr utility procedures */
123 return scm_caaar (x);
128 return scm_caadr (x);
133 return scm_cadar (x);
138 return scm_caddr (x);
143 return scm_cdaar (x);
148 return scm_cdadr (x);
153 return scm_cddar (x);
158 return scm_cdddr (x);
161 /* equivalent to (set-car! pair value) */
163 gh_set_car_x(SCM pair, SCM value)
165 return scm_set_car_x(pair, value);
168 /* equivalent to (set-cdr! pair value) */
170 gh_set_cdr_x(SCM pair, SCM value)
172 return scm_set_cdr_x(pair, value);
175 #endif /* SCM_ENABLE_DEPRECATED */