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