Clojurescript core.matrix aljabr implementation must be explicitly set

94 views Asked by At

Using core.matrix in a ClojureScript project. For javascript interop I need aljabr as explained in https://github.com/mikera/core.matrix/wiki/Matrix-implementations

After I try to specify the implementation (as I do with other Clojure implementations)

(require '[clojure.core.matrix :as mat])
(require '[thinktopic.aljabr.core :as imp])

(mat/set-current-implementation :aljabr)

I get this error and I can't use the matrix implementation for Javascript

INFO: No dynamic loading of implementations in Clojurescript.
You must require an implementation explicitly in a namespace, for example thinktopic.aljabr.core

Looking on github I only find the implementation used as I mention above (e.g. https://github.com/mars0i/free/commit/71dbbe4d58645ad4e25f2ac2d4ccba6ccef93968), how can I make aljabr work in cljs?

1

There are 1 answers

0
Alessandro Solbiati On

You need to set the implementation statically, that means not at the beginning of the file like you did but when you actually declare your matrix

(mat/matrix :aljabr [[1.0 2.0 3.0][4.0 5.0 7.0]])

(I answered to myself just cause there is no result on the internet for that error and took me a while to understand the error message explanation, even with git blames)