Alternatively, if really meant to use defn then it should have been;

(defn vect1 [] [1 2 3 4])
#'user/vect1
user=> (* (count (vect1)) 5)
20

On Mon, Sep 14, 2009 at 2:28 PM, Adrian Cuthbertson
<adrian.cuthbert...@gmail.com> wrote:
> Hi Jeff, you're using defn which defines a function instead of def
> which defines a var;
>
> (def vect1 [1 2 3 4])
> #'user/vect1
> user=> (* (count vect1) 5)
> 20
>
> Rgds, Adrian.
>
> On Mon, Sep 14, 2009 at 8:05 AM, Jeff Gross <j3f...@gmail.com> wrote:
>>
>> I have a vector that I need to count the size of and do a simple math
>> calculation with.
>> Say for example:
>> (defn vect1 [1 2 3 4])
>>
>> Typing (count vect1) returns the size of 4 that I need. I thought that
>> I could simply use (count vect1) in an a simple infix expression, ie:
>> (* (count vect1) 5)    however, I get a class cast exception error
>> that the java.lang.integer cannot be cast to clojure.lang.ifn. How
>> would I go about doing this correctly?
>>
>> >>
>>
>

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