0
此代碼,我寫給我的錯誤:Clojure的正常化功能運行時錯誤
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)))
任何提示將不勝感激。謝謝。
哦,我的天......我只是用C++編程,所以這就是爲什麼。謝謝! – Cody