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 deleteAll( int level; int value; List source; var List dest; ) {
	if ( source == null ) {
		dest = null;
		}
	else if ( source.value == value ) {
		deleteAll( level + 1, value, source.next, dest );
		}
	else {
		dest = new List{ source.value, null }; 
		deleteAll( level + 1, value, source.next, dest.next );
		}
	}
	
List source, a1, a2a, a4, a7, a2b, a9, dest;
a9 = new List{ 9, null };
a2b = new List{ 2, a9 };
a7 = new List{ 7, a2b };
a4 = new List{ 4, a7 };
a2a = new List{ 2, a4 };
a1 = new List{ 1, a2a };
source = a1;
deleteAll( 0, 2, source, dest );	// Inside this invocation
printList( source );
printList( dest );
