我写的这段代码给了我错误:
java.lang.Long cannot be cast to clojure.lang.IFn
这意味着我正在使用一个预期函数的数字。
我认为这与 clojure.math.numeric-tower 中的 expt 函数有关,但我不确定。神秘的错误信息 FTL。
(ns point-normalize.core
(:require [clojure.math.numeric-tower :as math :only (sqrt expt)]))
(defn normalize [x y]
(let [x1 (/ x (math/sqrt ((math/expt x 2)+ (math/expt y 2))))
y1 (/ y (math/sqrt ((math/expt x 2)+ (math/expt y 2))))]
(x1 y1)))
任何提示将不胜感激。谢谢你。