scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

A builtin way to detect arithmetic functions

Open hurufu opened this issue 4 months ago • 8 comments

I've coded all arithmetic functions explicitly in #2602

arithmetic_term(func, 0, [e,pi,epsilon]).
arithmetic_term(func, 1, [+,-,\,sqrt,exp,log,sin,cos,tan,asin,acos,atan,sign,abs,round,ceiling,floor,truncate,float,float_integer_part,float_fractional_part]).
arithmetic_term(func, 2, [+,-,/,*,**,^,/\,\/,xor,div,//,rdiv,<<,>>,mod,rem,max,min,gcd,atan2]).
arithmetic_term(rela, 2, [is,>,<,>=,=<,=:=,=\=]).

But it may go out-of-sync with the engine. I think it would be nice to have a builtin way to check if given term is an arithmetic function (similar to current_arithmetic_function/1 or arithmetic relation (>, <, etc.).

hurufu avatar Oct 09 '24 08:10 hurufu