简体   繁体   English

必须显式设置 Clojurescript core.matrix aljabr 实现

[英]Clojurescript core.matrix aljabr implementation must be explicitly set

Using core.matrix in a ClojureScript project.在 ClojureScript 项目中使用core.matrix For javascript interop I need aljabr as explained in https://github.com/mikera/core.matrix/wiki/Matrix-implementations对于 javascript 互操作,我需要aljabr,https://github.com/mikera/core.matrix/wiki/Matrix-implementations 中所述

After I try to specify the implementation (as I do with other Clojure implementations)在我尝试指定实现之后(就像我对其他 Clojure 实现所做的那样)

(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我收到这个错误,我不能使用 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 (eg https://github.com/mars0i/free/commit/71dbbe4d58645ad4e25f2ac2d4ccba6ccef93968 ), how can I make aljabr work in cljs?在 github 上查看我只找到我上面提到的实现(例如https://github.com/mars0i/free/commit/71dbbe4d58645ad4e25f2ac2d4ccba6ccef93968 ),我怎样才能让 aljabr 在 cljs 中工作?

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) (我回答自己只是因为互联网上没有该错误的结果,我花了一段时间才理解错误消息的解释,即使是 git 责备)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM