Hi,

I'm testing the use of records in Clojure and I have some issues when I try 
to call function of another namespaces from the record.

For testing purposes, I defined this record:

(ns test-record.component
  (:use test-record.utils))

(defprotocol Hierarchical
  "Protocol for tree."
  (children? [node] "children?"))

(defrecord Component [parent children name]
  Hierarchical
  (children? [node] (an-utils-function node)))

And I declared this namespace:

(ns test-record.utils)

(defn an-utils-function
  [c]
  (println (:name c)))

Very simple, isn't it?

But when I run this code in a REPL, I get an exception:

user=> (import 'test_record.component.Component)
test_record.component.Component
user=> (def c (Component. nil [] "The Root"))
#'user/c
user=>  (.children? c)
IllegalStateException Attempting to call unbound fn: 
#'test-record.utils/an-utils-function  clojure.lang.Var$Unbound.throwArity 
(Var.java:43)


Can I use functions of another namespaces from a record's code?

Thanks.



-- 
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