The corresponding Pascal type is closed to the C definition:
type list = ^cell; cell = record hd: integer; tl: list; end;
The cons function should also be explicitly defined,
and uses fields assignment to initialize the data.
{Creating a list cell}
function cons (x: integer; l: list): list;
var p: list;
begin
new(p);
p^.hd := x;
p^.tl := l;
cons := p
end;
Contact the author Pierre.Weis@inria.fr