Definitely yes. The compiler is already supporting it (see JFunction)
but not the JSPELParser. I have to check whether the juel parser
supports arbitrary function, if yes, only a relatively small
modification in DefaultFunctionFactory would be required.
This was the good news. The bad news is that I don't have time to add
new features until the (northern) summer. I have a lot of teaching at
the moment and also have to keep my research going. But I will
definitely add these features later this year. Or perhaps somebody else
wants to have a go???
Cheers, Jens
Any help is appreciated, and just documenting the problems and
challenges you face (in blog style) and making them available to us
would definitely help! Writing a benchmark would be even better.
Cheers, Jens
I have added another example to the repository that shows how to
interpret arbitrary functions encountered in scripts - see
example.nz.org.take.compiler.example2 package in the repository. Right
now, functions are only working if they occur in terms. E.g., the
example uses the following rule:
rule1: if 100<turnover(c,12) then category[c,"gold"]
I will add an issue (feature to be added in the next release) that
functions returning booleans can also be used directly as predicates.
Hope this helps for now! Jens
<file:///D:/development/workspaces/defaultworkspace/take/src/example/nz/org/take/compiler/example2/>
<file:///D:/development/workspaces/defaultworkspace/take/src/example/nz/org/take/compiler/example2/>
Regarding the example: I cannot reproduce the error, it works for me.
Could you check the TAKE version you have (1.5 or latest from
repository) and perhaps send me the stack trace?
Yes, scenario 3 uses functions as predicates but does not use the native
function syntax (it uses [..] instead of (..)).
I think the problem in your example is that you are using regex on the
address fields: regex[addr1.address,addr2.regex]. Therefore the script
parser will try to find a method regex in String (being the type of
addr1.address). This fails because such a method does not exist - regex
will be defined as a predicate that has to be defined by rules).
Cheers, Jens