Re: How to use/refer to multiple Clojure classes

2009-12-07 Thread songoku
 It does not look like wildcarding is supported in the ns macro and it
 seems silly to explicitly nominate each class that I want to have at
 my disposal. Am I thinking about this all wrong?

As far as i know you have to add each of them...

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


Re: How to use/refer to multiple Clojure classes

2009-12-07 Thread ataggart


On Nov 30, 9:21 am, Dan Kefford dan_keff...@hotmail.com wrote:
 OK... I'm trying to take Clojure for a spin on Project Euler problems.
 I have source files for each problem that I have solved and although I
 can refer to and invoke any one of them explicitly from a main class,
 I cannot seem to figure out how to refer to them all at once so that I
 can choose to run any one of them at runtime. Here is some code:

 main.clj
 
 (ns com.dankefford.projecteuler.main
     (:gen-class)
     (:use [com.dankefford.projecteuler.problems.1])
  )

 (defn -main []
   (run)
 )

 1.clj
 -
 (ns com.dankefford.projecteuler.problems.1
   (:gen-class)
   (:use [com.dankefford.projecteuler.util arithmetic])
 )

 (defn run []
   (print The sum of all the multiples of 3 or 5 below 1000 is: )
   (println (reduce + (filter #(or (divides? % 3) (divides? % 5))
 (range 1 1000
   )

 It does not look like wildcarding is supported in the ns macro and it
 seems silly to explicitly nominate each class that I want to have at
 my disposal. Am I thinking about this all wrong?

I would suggest you start by not thinking of namespaces as classes
(unless you're doing java interop stuff)/

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


How to use/refer to multiple Clojure classes

2009-11-30 Thread Dan Kefford
OK... I'm trying to take Clojure for a spin on Project Euler problems.
I have source files for each problem that I have solved and although I
can refer to and invoke any one of them explicitly from a main class,
I cannot seem to figure out how to refer to them all at once so that I
can choose to run any one of them at runtime. Here is some code:

main.clj

(ns com.dankefford.projecteuler.main
(:gen-class)
(:use [com.dankefford.projecteuler.problems.1])
 )

(defn -main []
  (run)
)

1.clj
-
(ns com.dankefford.projecteuler.problems.1
  (:gen-class)
  (:use [com.dankefford.projecteuler.util arithmetic])
)

(defn run []
  (print The sum of all the multiples of 3 or 5 below 1000 is: )
  (println (reduce + (filter #(or (divides? % 3) (divides? % 5))
(range 1 1000
  )

It does not look like wildcarding is supported in the ns macro and it
seems silly to explicitly nominate each class that I want to have at
my disposal. Am I thinking about this all wrong?

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