Closed light-matters closed 4 months ago
It makes no sense, but it stops working at commit c50267a89a1f9dd50eef56081b73df15ce81ffa4
It works at commit 6e209fa13f569c32e62a0f5a19d67a1af92c2e7e
It seems to be something to do with the double eval.
(ns physics.cavity.expr-debug
(:require
[wolframite.core :as wl]
[wolframite.wolfram-extended :as w]))
(def E1
(w/+ 't1 (w/* 'r1 (w/- 'E4))))
(def e4 (-> (w/== 'E4 E1)
(w/Solve 'E4)
wl/eval
w/First w/First))
(wl/eval e4)
fails with the error message, but
(def e4 (-> (w/== 'E4 E1)
(w/Solve 'E4)
;;wl/eval
w/First w/First))
(wl/eval e4)
doesn't.
The minimum example of failure is actually
(wl/eval (wl/eval (w/-> 'x 5)))
Somehow turning Wolfram rules into (-> ...) works but the other way doesn't anymore.
Still fails with
1. Unhandled java.lang.IllegalArgumentException
No matching ctor found for class com.wolfram.jlink.Expr
Reflector.java: 337 clojure.lang.Reflector/invokeConstructor
jlink_proto_impl.clj: 43 wolframite.impl.jlink-proto-impl.JLinkImpl/expr
Either we should resupport aliasing -> to Rule or w/-> should evaluate to 'Rule'.
Well, base-aliases
do contain '-> 'Rule
so I am not sure that aliasing is the core problem here.
Not sure what eactly is going on here, but the exception is thrown on the second eval, when we try to turn 5
into an expr using (Expr. 5)
- which fails b/c 5 here is Integer, not int, i.e. not primitive.
good find
As described below,
The minimum example of failure is
(wl/eval (wl/eval (w/-> 'x 5)))
Somehow turning Wolfram Rules into (-> ...) works but the other way doesn't anymore.
Aside: Can we add a practical example of leveraging rules to the docs/demo?
Origina description
Load for-scientists.cavity-physics namespace and try building the html. The same namespace works fine using the wolframite-examples project (where wolframite is imported as a library).
Fails with the falling error: