Fork me on GitHub
#sci
<
2022-01-12
>
Sam Ritchie22:01:29

Execution error (ExceptionInfo) at sci.impl.utils/throw-error-with-location (utils.cljc:22).
Could not resolve symbol: java.lang.Math/abs

Sam Ritchie22:01:49

Question… is there some other way to call Math/abs inside an sci macro?

borkdude22:01:30

$ bb -e '(java.lang.Math/abs -1)'
1
yes, but you have to explicitly add it to :classes

borkdude22:01:50

{:classes {'java.lang.Math java.lang.Math}}

Sam Ritchie22:01:36

nice and that will work with sci in a js environment?

borkdude22:01:09

in JS, if you want to give access to anything, you do: {:classes {'js goog/global :allow :all}}

borkdude22:01:45

but you have to write (js/Math.abs ...) in this case. If you want to allow (Math/abs ...) then you also need to insert 'Math explicitly

Sam Ritchie22:01:14

yup, I had ported the “fork” macro from macrovich to work in sci so I could explicitly provide js/Math for this case

Sam Ritchie22:01:56

thank you!

👍 1