Open BrandonHaynes opened 9 years ago
You know that you can define little inline functions (like Lambda expressions), right?
def logN(a, b): log(a) / log(b);
will let you use logN
in your program.
But, yes, this is a great suggestion. The place to do this is in the Expression Library: https://github.com/uwescience/raco/blob/master/raco/expression/expressions_library.py#L34
Overloading works (see SafeDiv
), but I am not certain what will happen if you add a 2-ary log
to the expressions library while leaving the unary log
, which is in the language, alone... :) It might just work!
Oh nice -- I did not know that the language supported inline functions. Thanks for mentioning that!
We need docs on that. And how to write stateful apply and UDAs. I'd be happy to write the latter some time next month. Ref https://github.com/uwescience/myria-docs/blob/master/myriaql.markdown
@domoritz is there a issue in myria-docs to track that?
@bmyerz No, oh I mean yes https://github.com/uwescience/myria-docs/issues/9
I have a
while
statement that needs to run log_2 n times. If overloading is supported, it would be nice to be able to specify a base for the existinglog
function. (I guess alog2
function would work as well; I find both options to be more clear thanlog(n) / log(2)
).