# A function that can be called with a code section. # The code section is expected to take an integer as parameter, # and return a string. routine Test()[X:int=>string] => string { io.writeln( "In functional method!" ); var s = yield( 123 ); # execute the code section; io.writeln( "Yielded value:", s ); return s; } Test { [X] io.writeln( "In code section:", X ); return "abc"; } routine Test( alist : list<@T> )[ item :@T, index :int => none|int ] =>list<@T> { yield( 55, 0 ); # invoke the code section of the caller; io.writeln( alist.collect{ [X] if( X < 33 ) return X } ); # call the list functional method with the caller"s code section; return alist.collect{ [X,Y] yield(X,Y) }; } var res = Test( {11,22,33,44} ){ [X] X > 22 } io.writeln( res, std.about(res) );