This code,

(defprotocol Matrix
  (matrix-get [this c r]))

(deftype Matrix2D [data height width]
  Matrix
  (matrix-get [this r c] 1))

Gives me this error

Exception in thread "main" java.lang.IllegalArgumentException: Can't
define method not in interfaces: matrix_get (core.clj:6)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:5376)
        at clojure.lang.Compiler.analyze(Compiler.java:5190)
        at clojure.lang.Compiler.analyze(Compiler.java:5151)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4670)
        at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:4941)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:5369)
        at clojure.lang.Compiler.analyze(Compiler.java:5190)
        at clojure.lang.Compiler.analyze(Compiler.java:5151)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4670)
        at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4328)
        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3173)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:5367)
        at clojure.lang.Compiler.analyze(Compiler.java:5190)
        at clojure.lang.Compiler.eval(Compiler.java:5421)
        at clojure.lang.Compiler.load(Compiler.java:5857)
        at clojure.lang.Compiler.loadFile(Compiler.java:5820)
        at clojure.main$load_script.invoke(main.clj:221)
        at clojure.main$script_opt.invoke(main.clj:273)
        at clojure.main$main.doInvoke(main.clj:354)
        at clojure.lang.RestFn.invoke(RestFn.java:409)
        at clojure.lang.Var.invoke(Var.java:365)
        at clojure.lang.AFn.applyToHelper(AFn.java:163)
        at clojure.lang.Var.applyTo(Var.java:482)
        at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: Can't define method not
in interfaces: matrix_get
        at clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:6558)
        at clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:6202)
        at clojure.lang.Compiler$NewInstanceExpr
$DeftypeParser.parse(Compiler.java:6086)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:5369)
        ... 23 more

Simply changing the name of the function to get-cell removed this
problem, but I feel a need to know what is wrong with this.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to