[R] linear lists, creation, insertion, deletion, traversal *someone?*

Christian Hoffmann christian.hoffmann at wsl.ch
Wed Mar 1 14:09:39 CET 2006


Hi,

In a second try I will ask this list to give me some useful pointers.

Linear lists, as described e.g. by N.Wirth in "Algorithms and Data
Structures", seem not to be implemented in S/R, although in lisp we have 
cons, car, cdr.

Nevertheless I want to implement an algorithm using such linear lists, 
porting a trusted program to R (S). I need:

(from Modula/Oberon)
	pSC* = POINTER TO SC;
	SC* = RECORD	Next*: pSC; ......
...     END;

# generate and fill a linked list:
VAR   p, pA, Kol: pSC;
	NEW( Kol);
	pA := Kol;
	while () {
		NEW( p );
		pA.Next := p;
		pA := p;
		...
	}

Mapping this list management to R's list() is possible, but may not be 
so transparent. Insertions and deletions from a list may be more convoluted.

Does anybody have experience in this? I could not find any reference in
R resources, also the Blue Book is mute here.

Thank you
Christian
-- 
Dr. Christian W. Hoffmann,
Swiss Federal Research Institute WSL
Mathematics + Statistical Computing
Zuercherstrasse 111
CH-8903 Birmensdorf, Switzerland

Tel +41-44-7392-277  (office)   -111(exchange)
Fax +41-44-7392-215  (fax)
christian.hoffmann at wsl.ch
http://www.wsl.ch/staff/christian.hoffmann

International Conference 5.-7.6.2006 Ekaterinburg Russia
"Climate changes and their impact on boreal and temperate forests"
http://ecoinf.uran.ru/conference/




More information about the R-help mailing list