function apply_to_all(sequence s, integer f) -- apply a function to all elements of a sequence sequence result result = {} for i = 1 to length(s) do -- we can call add1() here although it comes later in the program result = append(result, call_func(f, {s[i]})) end for return result end function function add1(atom x) return x + 1 end function -- add1() is visible here, so we can ask for its routine id ? apply_to_all({1, 2, 3}, routine_id("add1")) -- displays {2,3,4}