Create a function that doesn't compute any intermediate values from A while producing a value of type B.
Create a function that doesn't compute any intermediate values from A while producing a value of type B.
input type to the resulting function
output type of the resulting function
string specification of the function.
a function taking no variables and returns a value of type C
a function F = f(x). Essentially a delegate that delegates to f. This mainly means that the definer of f needs to either make f invariant to an input of A or needs to have inside knowledge of A.
Create a function in one variable that takes an instance of A and returns a value of type C.
Create a function in one variable that takes an instance of A and returns a value of type C. Note that this function like the other functions in GenFunc are provided to assist type resolution. When generating code, it's really nice not to have to specify the type of the variables because we can just let the type resolution mechanism in Scala take care of it.
// Get the value associated with the "one" key in the map and add 1 to it. val f1 = GenFunc.f1( GeneratedAccessor( "one", // The descriptor of the variable. (_:Map[String, Int]) get "one", // The actual implementation. Some("""(_:Map[String, Int]) get "one"""") // Optional String description of extractor. ) )( "${one} + 1", // Description of function. _.map(_ + 1) // No typing information necessary. ) f1(Map("one" -> 1)) // Some(2) f1.accessorOutputMissing(Map()) // List("one") The list of missing fields (variables) required by f1.
input type to the resulting function
the type of the variable used in the function
output type of the resulting function
A function that pulls a variables value out of the input type.
string specification of the function.
a function taking one variable (the value returned by f1) that returns type C
a function F = f(f1(x)) in one variable that extracts x's value with accessor function f1.
Provides a series of functions that create instances of GenFuncN. These are preferable to calling the class constructors directly because we can completely avoid specifying typing information do to the multiple argument lists in the functions. This helps especially when generating code via multi-stage programming.