Mapping sqrt() to √ symbol

23 views
Skip to first unread message

Bert Mariani

unread,
Jul 10, 2024, 6:46:37 PM (12 days ago) Jul 10
to The Ring Programming Language
Hello Mahmoud et ALL

I am trying to use the symbol  √  for  sqrt  for easier reading 
 √ = 0x221A
Is it possible ?

Sect 35.4
ChangeRingOperator <oldoperator> <newoperator>
example:   ChangeRingOperator  =  is

Code:

See "Sqrt: "+ sqrt(9) +nl
ChangeRingOperator  sqrt   √
 See " √  : "+ √(9)    +nl

Warning (W6) : Compiler command ChangeRingOperator - Operator not found!
Operator :  sqrt

Sqrt: 3

Line 60 Error (R3) : Calling Function without definition: √
in file 3D-Polar-Cartesian-1.ring

Ilir Liburn

unread,
Jul 10, 2024, 8:14:52 PM (12 days ago) Jul 10
to The Ring Programming Language
Hello Bert,

sqrt is not an operator, it is a function. Command changeringoperator only works with single characters, for example ** or ^^ are not supported.

Instead, you should use function which wraps sqrt

? √(10)


func √ val

return sqrt(val)


Greetings,

Ilir


Bert Mariani

unread,
Jul 11, 2024, 11:47:13 AM (11 days ago) Jul 11
to The Ring Programming Language
Thanks Illir !!

It work just fine.

Ilir Liburn

unread,
Jul 11, 2024, 11:54:59 AM (11 days ago) Jul 11
to The Ring Programming Language
Hello Bert,

You're Welcome.

Greetings,
Ilir

Reply all
Reply to author
Forward
0 new messages