guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make an element last element of a list


From: Stephen Compall
Subject: Re: make an element last element of a list
Date: 21 Oct 2003 16:42:56 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Laurent Marzullo <address@hidden> writes:

> I've got a scheme list 
> 
> SCM   scm_game_list;
> 
> and I want to add, with C API, an elements at the end of
> the list.
> 
> Is there any function to do this or must I go throw the entire
> list and adding a new scm_cons( new_elem , SCM_EOL ) at the end ?

#ifdef HUMBLE_OPINION
Maybe you don't want to hear this, but how are you building the list?
If you must have access to the list in the order in which you seem to
be working on it above *before* you add elements to the list, then you
ought to keep track of the last cell, as well as scm_game_list.

If you are building the list first, then using it, but still need the
order, then it would be best to cons new elements onto the front, then
use scm_reverse_x (saving the return value).

If you don't care about the order at all, just cons new items onto the
beginning.
#endif

--
Stephen Compall or s11 or sirian

I'm not proud.

asset Freeh TELINT ANC Baranyi MD4 Lon Horiuchi cryptanalysis PGP bomb
LLNL quiche halcon SRI colonel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]