// Program to test building of data structures program var getValue = funct( a ) begin return a[ 0 ]; end, getNext = funct( a ) begin return a[ 1 ]; end, setValue = funct( a, value ) begin a[ 0 ] = value; end, setNext = funct( a, next ) begin a[ 1 ] = next; end, printList = funct( a ) begin print( "{ " ); while a <> null do print( getValue( a ) ); a = getNext( a ); if a <> null then print( ", " ); end end print( " }" ); end, appendList = funct( a, data ) var b; begin if a == null then a = { data, null }; else for b = a; getNext( b ) <> null; b = getNext( b ) do end setNext( b, { data, null } ); end return a; end, createList = funct( data ) var a, i; begin a = null; for i = 0; i < size data; i = i + 1 do a = appendList( a, data[ i ] ); end return a; end, i, a, b; begin a = { 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.