class List( int value; List next; ); void printList( List source; ) { print( "{ " ); while ( source != null ) { print( source.value ); source = source.next; if ( source != null ) print( ", " ); } println( " }" ); } void concatList( int level; List source1, source2; var List dest; ) { if ( source1 == null ) { dest = source2; // At this point } else { dest = new List{ source1.value, null }; concatList( level + 1, source1.next, source2, dest.next ); // Inside the above invocation } } List source1, source2, a2, a4, a7, a9, dest; a9 = new List{ 9, null }; a7 = new List{ 7, a9 }; a4 = new List{ 4, null }; a2 = new List{ 2, a4 }; source1 = a7; source2 = a2; concatList( 0, source1, source2, dest ); // Inside this invocation printList( source1 ); printList( source2 ); printList( dest );