Mention scm_car, etc as the replacement for gh_car, etc.
[bpt/guile.git] / libguile / gh_list.c
CommitLineData
58ade102 1/* Copyright (C) 1995,1996,1997, 2000, 2001 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
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
ee2a8b9b
JB
17\f
18
19/* list manipulation */
20
a0599745 21#include "libguile/gh.h"
ee2a8b9b
JB
22
23/* returns the length of a list */
c014a02e 24unsigned long
92396c0a 25gh_length (SCM l)
ee2a8b9b 26{
92396c0a 27 return gh_scm2ulong (scm_length (l));
ee2a8b9b
JB
28}
29
30/* list operations */
31
7fee59bd
MG
32/* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */
33
34/* gh_append() takes a args, which is a list of lists, and appends
35 them all together into a single list, which is returned. This is
36 equivalent to the Scheme procedure (append list1 list2 ...) */
1be6b49c 37SCM
1afff620 38gh_append (SCM args)
7fee59bd 39{
1afff620 40 return scm_append (args);
7fee59bd
MG
41}
42
1be6b49c 43SCM
1afff620 44gh_append2 (SCM l1, SCM l2)
7fee59bd 45{
1afff620 46 return scm_append (scm_list_2 (l1, l2));
7fee59bd
MG
47}
48
1be6b49c
ML
49SCM
50gh_append3(SCM l1, SCM l2, SCM l3)
7fee59bd 51{
1afff620 52 return scm_append (scm_list_3 (l1, l2, l3));
7fee59bd
MG
53}
54
1be6b49c 55SCM
1afff620 56gh_append4 (SCM l1, SCM l2, SCM l3, SCM l4)
7fee59bd 57{
1afff620 58 return scm_append (scm_list_4 (l1, l2, l3, l4));
7fee59bd
MG
59}
60
61/* gh_reverse() is defined as a macro in gh.h */
62/* gh_list_tail() is defined as a macro in gh.h */
63/* gh_list_ref() is defined as a macro in gh.h */
64/* gh_memq() is defined as a macro in gh.h */
65/* gh_memv() is defined as a macro in gh.h */
66/* gh_member() is defined as a macro in gh.h */
67/* gh_assq() is defined as a macro in gh.h */
68/* gh_assv() is defined as a macro in gh.h */
69/* gh_assoc() is defined as a macro in gh.h */
70
ee2a8b9b
JB
71/* analogous to the Scheme cons operator */
72SCM
73gh_cons (SCM x, SCM y)
74{
75 return scm_cons (x, y);
76}
77
ee2a8b9b
JB
78/* analogous to the Scheme car operator */
79SCM
80gh_car (SCM x)
81{
82 return SCM_CAR (x);
83}
84
85/* analogous to the Scheme cdr operator */
86SCM
87gh_cdr (SCM x)
88{
89 return SCM_CDR (x);
90}
91
92/* now for the multiple car/cdr utility procedures */
93SCM
94gh_caar (SCM x)
95{
96 return SCM_CAAR (x);
97}
98SCM
99gh_cadr (SCM x)
100{
101 return SCM_CADR (x);
102}
103SCM
104gh_cdar (SCM x)
105{
106 return SCM_CDAR (x);
107}
108SCM
109gh_cddr (SCM x)
110{
111 return SCM_CDDR (x);
112}
113
114SCM
115gh_caaar (SCM x)
116{
117 return SCM_CAAAR (x);
118}
119SCM
120gh_caadr (SCM x)
121{
122 return SCM_CAADR (x);
123}
124SCM
125gh_cadar (SCM x)
126{
127 return SCM_CADAR (x);
128}
129SCM
130gh_caddr (SCM x)
131{
132 return SCM_CADDR (x);
133}
134SCM
135gh_cdaar (SCM x)
136{
137 return SCM_CDAAR (x);
138}
139SCM
140gh_cdadr (SCM x)
141{
142 return SCM_CDADR (x);
143}
144SCM
145gh_cddar (SCM x)
146{
147 return SCM_CDDAR (x);
148}
149SCM
150gh_cdddr (SCM x)
151{
152 return SCM_CDDDR (x);
153}
7fee59bd
MG
154
155/* equivalent to (set-car! pair value) */
156SCM
157gh_set_car_x(SCM pair, SCM value)
158{
159 return scm_set_car_x(pair, value);
160}
161
162/* equivalent to (set-cdr! pair value) */
163SCM
164gh_set_cdr_x(SCM pair, SCM value)
165{
166 return scm_set_cdr_x(pair, value);
167}
89e00824
ML
168
169/*
170 Local Variables:
171 c-file-style: "gnu"
172 End:
173*/