program
type list = struct( value : int;  next : list; );
funct printList( a : list; ) void
	begin
		print( "{ " );
		while a <> null do
			print( a.value );
			a = a.next;
			if a <> null then
				print( ", " );
			end
		end
		print( " }" );
	end
funct appendList( var a : list; data : int; ) void
	var b : list;
	begin
		if a == null then
			a = new list { data, null };
		else
			for b = a; b.next <> null; b = b.next do
			end
			b.next = new list { data, null };
		end
	end
funct createList( data : []int; ) list
	var a : list;
	var i : int;
	begin
		a = null;
		for i = 0; i < size data; i = i + 1 do
			appendList( a, data[ i ] );
		end
		return a;
	end
var i : int;
var a : []int;
var b : list;
begin
	a = new []int { 1, 2, 4, 8, 16, 32 };
	for i = 0; i < size a; i = i + 1 do
		println( a[ i ] );
	end
	b = createList( a );
	printList( b );
	println();
end.
