Commit | Line | Data |
---|---|---|
dbb605f5 | 1 | /* Copyright (C) 1995,1996,1997, 2000, 2001, 2004, 2006, 2008 Free Software Foundation, Inc. |
ee2a8b9b | 2 | |
73be1d9e MV |
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. | |
ee2a8b9b | 7 | * |
73be1d9e MV |
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. | |
ee2a8b9b | 12 | * |
73be1d9e MV |
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 | |
92205699 | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
73be1d9e | 16 | */ |
ee2a8b9b | 17 | \f |
dbb605f5 LC |
18 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | |
20 | #endif | |
21 | ||
ee2a8b9b JB |
22 | |
23 | /* list manipulation */ | |
24 | ||
a0599745 | 25 | #include "libguile/gh.h" |
ee2a8b9b | 26 | |
5c56ebe1 MV |
27 | #if SCM_ENABLE_DEPRECATED |
28 | ||
ee2a8b9b | 29 | /* returns the length of a list */ |
c014a02e | 30 | unsigned long |
92396c0a | 31 | gh_length (SCM l) |
ee2a8b9b | 32 | { |
92396c0a | 33 | return gh_scm2ulong (scm_length (l)); |
ee2a8b9b JB |
34 | } |
35 | ||
36 | /* list operations */ | |
37 | ||
7fee59bd MG |
38 | /* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */ |
39 | ||
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 ...) */ | |
1be6b49c | 43 | SCM |
1afff620 | 44 | gh_append (SCM args) |
7fee59bd | 45 | { |
1afff620 | 46 | return scm_append (args); |
7fee59bd MG |
47 | } |
48 | ||
1be6b49c | 49 | SCM |
1afff620 | 50 | gh_append2 (SCM l1, SCM l2) |
7fee59bd | 51 | { |
1afff620 | 52 | return scm_append (scm_list_2 (l1, l2)); |
7fee59bd MG |
53 | } |
54 | ||
1be6b49c ML |
55 | SCM |
56 | gh_append3(SCM l1, SCM l2, SCM l3) | |
7fee59bd | 57 | { |
1afff620 | 58 | return scm_append (scm_list_3 (l1, l2, l3)); |
7fee59bd MG |
59 | } |
60 | ||
1be6b49c | 61 | SCM |
1afff620 | 62 | gh_append4 (SCM l1, SCM l2, SCM l3, SCM l4) |
7fee59bd | 63 | { |
1afff620 | 64 | return scm_append (scm_list_4 (l1, l2, l3, l4)); |
7fee59bd MG |
65 | } |
66 | ||
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 */ | |
76 | ||
ee2a8b9b JB |
77 | /* analogous to the Scheme cons operator */ |
78 | SCM | |
79 | gh_cons (SCM x, SCM y) | |
80 | { | |
81 | return scm_cons (x, y); | |
82 | } | |
83 | ||
ee2a8b9b JB |
84 | /* analogous to the Scheme car operator */ |
85 | SCM | |
86 | gh_car (SCM x) | |
87 | { | |
5e9e56ed | 88 | return scm_car (x); |
ee2a8b9b JB |
89 | } |
90 | ||
91 | /* analogous to the Scheme cdr operator */ | |
92 | SCM | |
93 | gh_cdr (SCM x) | |
94 | { | |
5e9e56ed | 95 | return scm_cdr (x); |
ee2a8b9b JB |
96 | } |
97 | ||
98 | /* now for the multiple car/cdr utility procedures */ | |
99 | SCM | |
100 | gh_caar (SCM x) | |
101 | { | |
5e9e56ed | 102 | return scm_caar (x); |
ee2a8b9b JB |
103 | } |
104 | SCM | |
105 | gh_cadr (SCM x) | |
106 | { | |
5e9e56ed | 107 | return scm_cadr (x); |
ee2a8b9b JB |
108 | } |
109 | SCM | |
110 | gh_cdar (SCM x) | |
111 | { | |
5e9e56ed | 112 | return scm_cdar (x); |
ee2a8b9b JB |
113 | } |
114 | SCM | |
115 | gh_cddr (SCM x) | |
116 | { | |
5e9e56ed | 117 | return scm_cddr (x); |
ee2a8b9b JB |
118 | } |
119 | ||
120 | SCM | |
121 | gh_caaar (SCM x) | |
122 | { | |
5e9e56ed | 123 | return scm_caaar (x); |
ee2a8b9b JB |
124 | } |
125 | SCM | |
126 | gh_caadr (SCM x) | |
127 | { | |
5e9e56ed | 128 | return scm_caadr (x); |
ee2a8b9b JB |
129 | } |
130 | SCM | |
131 | gh_cadar (SCM x) | |
132 | { | |
5e9e56ed | 133 | return scm_cadar (x); |
ee2a8b9b JB |
134 | } |
135 | SCM | |
136 | gh_caddr (SCM x) | |
137 | { | |
5e9e56ed | 138 | return scm_caddr (x); |
ee2a8b9b JB |
139 | } |
140 | SCM | |
141 | gh_cdaar (SCM x) | |
142 | { | |
5e9e56ed | 143 | return scm_cdaar (x); |
ee2a8b9b JB |
144 | } |
145 | SCM | |
146 | gh_cdadr (SCM x) | |
147 | { | |
5e9e56ed | 148 | return scm_cdadr (x); |
ee2a8b9b JB |
149 | } |
150 | SCM | |
151 | gh_cddar (SCM x) | |
152 | { | |
5e9e56ed | 153 | return scm_cddar (x); |
ee2a8b9b JB |
154 | } |
155 | SCM | |
156 | gh_cdddr (SCM x) | |
157 | { | |
5e9e56ed | 158 | return scm_cdddr (x); |
ee2a8b9b | 159 | } |
7fee59bd MG |
160 | |
161 | /* equivalent to (set-car! pair value) */ | |
162 | SCM | |
163 | gh_set_car_x(SCM pair, SCM value) | |
164 | { | |
165 | return scm_set_car_x(pair, value); | |
166 | } | |
167 | ||
168 | /* equivalent to (set-cdr! pair value) */ | |
169 | SCM | |
170 | gh_set_cdr_x(SCM pair, SCM value) | |
171 | { | |
172 | return scm_set_cdr_x(pair, value); | |
173 | } | |
89e00824 | 174 | |
5c56ebe1 MV |
175 | #endif /* SCM_ENABLE_DEPRECATED */ |
176 | ||
89e00824 ML |
177 | /* |
178 | Local Variables: | |
179 | c-file-style: "gnu" | |
180 | End: | |
181 | */ |