scicloj / wolframite

An interface between Clojure and Wolfram Language (the language of Mathematica)
Eclipse Public License 2.0
46 stars 2 forks source link

Need a consistent way of quoting #53

Closed light-matters closed 3 days ago

light-matters commented 1 month ago
(eval-> '(w/Cos x)
        (w/Solve 'x))

(eval-> '(== 0 (Cos x))
        '(w/Solve x))

(eval-> '(== 0 (Cos x))
        (w/Solve 'x))

Only the third way works of the three. This is because quoting while using the loaded symbols doesn't work. Might be better to use a standard macro for templating expressions.

light-matters commented 1 month ago

Another example that came up (with no obvious solution):

(-> '(<-> (Cos x)
            (..> (Cos (_))
                 (* (+ 1
                       (* -1
                          (**2 t)))
                    (**-1 (+ 1
                             (**2 t))))))
      '(ReplaceAll  (Rule t 5))
      eval)

This fails with 'Wrong number of args (2) passed to quote', whereas

(eval '(ReplaceAll (<-> (Cos x)
                          (..> (Cos (_))
                               (* (+ 1
                                     (* -1
                                        (**2 t)))
                                  (**-1 (+ 1
                                           (**2 t))))))
                     (Rule t 5)))

returns -12/13, as expected.

light-matters commented 1 month ago

Getting the threading macro to work as expected is important as being able to chain expressions is a really nice feature with respect to Wolfram.

light-matters commented 1 month ago

This may be a duplicate of #45.