basic operations on return of aget rejected
timsgardner opened this issue · 1 comments
timsgardner commented
(require '[gamma.api :as g])
(g/+ 1 (g/aget (g/vec3 2) 0))
throws:
gamma-tools.core=> System.Exception: Arguments to + must have type :int or :float
at gamma/api$_PLUS___172.invoke (System.Object , System.Object ) [0x000a1] in api.clj:210
at gamma_tools/core$eval__3333__3338.invoke () [0x00000] in <filename unknown>:0
at clojure.lang.Compiler.eval (System.Object form) [0x00000] in <filename unknown>:0
at clojure.lang.Compiler.eval (System.Object form) [0x00000] in <filename unknown>:0
at clojure/core$eval__57691.invoke (System.Object ) [0x00000] in core.clj:3076
at arcadia/repl$repl_eval_print$fn__28359__28363.invoke () [0x001e3] in repl.clj:59
at arcadia/repl$repl_eval_print__28366.invoke (System.Object , System.Object ) [0x0041e] in repl.clj:57
at arcadia/repl$repl_eval_string__28382.invoke (System.Object , System.Object ) [0x0002f] in repl.clj:75
at arcadia/repl$repl_eval_string__28382.invoke (System.Object ) [0x00000] in repl.clj:72
at arcadia/repl$eval_queue$fn__28390__28394.invoke () [0x00000] in repl.clj:84
and
(g/float (g/aget (g/vec3 1) 0))
throws:
gamma-tools.core=> System.Exception: Wrong argument types for term float:
at gamma/api$build_standard_function_term__284.invoke (System.Object , System.Object , System.Object ) [0x00110] in api.clj:329
at gamma/api$float__338.doInvoke (System.Object ) [0x00000] in api.clj:331
at clojure.lang.RestFn.invoke (System.Object arg1) [0x00000] in <filename unknown>:0
at gamma_tools/core$eval__3347__3352.invoke () [0x00000] in <filename unknown>:0
at clojure.lang.Compiler.eval (System.Object form) [0x00000] in <filename unknown>:0
at clojure.lang.Compiler.eval (System.Object form) [0x00000] in <filename unknown>:0
at clojure/core$eval__57691.invoke (System.Object ) [0x00000] in core.clj:3076
at arcadia/repl$repl_eval_print$fn__28359__28363.invoke () [0x001e3] in repl.clj:59
at arcadia/repl$repl_eval_print__28366.invoke (System.Object , System.Object ) [0x0041e] in repl.clj:57
at arcadia/repl$repl_eval_string__28382.invoke (System.Object , System.Object ) [0x0002f] in repl.clj:75
at arcadia/repl$repl_eval_string__28382.invoke (System.Object ) [0x00000] in repl.clj:72
at arcadia/repl$eval_queue$fn__28390__28394.invoke () [0x00000] in repl.clj:84
timsgardner commented
This seems to work as an alternative to aget
in many situations:
(defn hero-aget [v i]
(g/+ 0 (g/aget v (g/int i))))
(assuming #29)