concepts.dsl.learning.function_domain_search.gen_merge_functions#
- gen_merge_functions(f1, arg_index=None, f2=None)[source]#
Generate merge functions. Specifically, given two functions f1 and f2, this function generates a new function. For example, given f1(x, y) and f2(z), with arg_index = 1, this function generates:
def merged(x, z): return f1(x, f2(z))
That is, we first apply f2 with the input arguments, and then apply f1 with the rest of the arguments and the output of f2.
A special case is when f2 is None. In this case, we generate a function that is simply a wrapper of f1.