I found a interesting GLSL code on Twitter: https://twitter.com/valentin_galea/status/1188147946468134913
I tried to write a code in similar way in Nim, but no success.
proc foo: float =
1.0 / (1.0 + 2.0 + 3.0)
proc foo2: float =
# compile error
(1.0
/
(1.0 + 2.0 + 3.0))
template `--------------------`(x, y: untyped): untyped = x / y
proc foo3: float =
1.0 -------------------- (1.0 + 2.0 + 3.0)
proc foo4: float =
# compile error
( 1.0
--------------------
(1.0 + 2.0 + 3.0))
Is it impossible to write code like this in Nim?
Thank you! This code worked.
proc foo: float =
( 1.0 )/
#-----------------
(1.0 + 2.0 + 3.0)
echo foo()