class List
	begin
		instance
			int value;  
			List next;
			List init( int value; List next; )
				begin
					this.value = value;
					this.next = next;
					return this;
				end
	end

void appendText( var []char result; []char text; )
        begin
                result = result + text;
        end    

void buildListText( List a; var []char result; )
        begin
                if a <> null then
                        appendText( result, a.value );
                        if a.next <> null then
                                appendText( result, ", " );
                                buildListText( a.next, result );
                        end
                end
        end
                       
List a, a1, a3, a5;
[]char result;
a5 = new List.init( 5, null );
a3 = new List.init( 3, a5 );
a1 = new List.init( 1, a3 );
a = a1;
result = "{ ";
buildListText( a, result );
appendText( result, " }" );
println( result );
