Re: Invoking Java method through method name as a String

2009-02-21 Thread Michael Wood
On Sun, Feb 22, 2009 at 4:44 AM, Richard Lyman wrote: [...] > user=> (defn str-invoke [instance method-str & args] > (clojure.lang.Reflector/invokeInstanceMethod instance method-str (into-array > args))) > #'user/str-invoke > user=> (def i "sampleString") > #'user/i > user=> (def m "substring") >

Re: Clojure Questions

2009-02-21 Thread Michael Wood
On Sat, Feb 21, 2009 at 9:14 PM, Richard Lyman wrote: > From the http://clojure.org/getting_started page: > > "Clojure is delivered in a zip file containing a single .jar, clojure.jar, a > readme, the CPL license and the source code in a src subdirectory. It uses > the ASM 3.0 bytecode library, a

Re: arguments to dissoc and select-keys

2009-02-21 Thread samppi
I see—that explains a lot. On Feb 21, 5:01 pm, Rich Hickey wrote: > On Feb 21, 5:58 pm, samppi wrote: > > > Allowing dissoc and select-keys to accept both keys as arguments and > > as a collection would be nice, and backwards compatible. > > Nope - Collections can be keys. > > > In any case, >

Re: dotimes suggestion

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 8:53 PM, André Thieme wrote: > > On 21 Feb., 18:24, Mark Volkmann wrote: >> Currently the dotimes macro requires its first argument to be a vector >> for binding a variable to the number of times the body should be >> executed. Inside the body, that variable is bound to t

Re: Clojure Naming Conventions

2009-02-21 Thread Luc Prefontaine
We chose to keep a naming convention for constants mainly because we are mixing Java, Ruby and Clojure in the same system. We have to replicate constants between the different languages. We needed a common anchor somehow to keep track of things and be able to track down changes. We typically use u

Re: Clojure Naming Conventions

2009-02-21 Thread Chouser
On Sat, Feb 21, 2009 at 9:05 PM, David Nolen wrote: > Thanks for the points. > What I was thinking, was that for things like π, in Clojure (as in CL), > perhaps it makes to sense to mark it like so: > +pi+ Is 'pi' more constant than, say, 'rem'? One implements IFn, the other doesn't, but neithe

Re: generic functions update

2009-02-21 Thread Raffael Cavallaro
count me as very interested too. regards, Ralph --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send ema

Road to Clojure on c.l.l

2009-02-21 Thread Mibu
comp.lang.lisp had a great Road to Clojure Survey thread which was actually an x-is-better-than-y thread that turned into a full blown flamewar. http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/0d05837df1efe075 These kind of threads are usually pointless, but this specific thre

Contrib tests on new Lazy Clojure

2009-02-21 Thread Stuart Sierra
Hi all, I added a file to contrib, "load_all.clj", to help test which libraries don't work under the new, lazier, Clojure. It's just a script that "require"s every lib. I think I got them all; please add any that are missing. I deliberately left out "test_clojure.clj" and "test_contrib.clj" be

Re: dotimes suggestion

2009-02-21 Thread André Thieme
On 21 Feb., 18:24, Mark Volkmann wrote: > Currently the dotimes macro requires its first argument to be a vector > for binding a variable to the number of times the body should be > executed. Inside the body, that variable is bound to the values from 0 > to that number minus 1. How about changing

Re: Invoking Java method through method name as a String

2009-02-21 Thread Richard Lyman
Cool... that looks like it got me past the 'method-as-a-string' problem, but now I'm getting errors with not finding a matching method on the class by that name. I'm guessing that this means there was a problem matching the type signature of the method. The arguments to the method are stored in a

Re: arguments to dissoc and select-keys

2009-02-21 Thread Raffael Cavallaro
On Feb 21, 6:47 pm, Mark Volkmann wrote: > I have to wrap the keys in a collection like this instead. > > (select-keys popsicle-map [:red :green :blue]) of course if you're doing this much: user=> (defmacro take-keys [some-map & keys+] `(select-keys ~some-map ~(vec keys+))) #'user/

Re: arguments to dissoc and select-keys

2009-02-21 Thread Jeffrey Straszheim
On Sat, Feb 21, 2009 at 8:49 PM, David Nolen wrote: > > Ah the power of Clojure ;) The fact that (almost?) anything can be a key is > a pretty liberating thing. > It is truly an amazing ability. --~--~-~--~~~---~--~~ You received this message because you are subs

Re: dependencies + observers + java interop: how to?

2009-02-21 Thread Jeffrey Straszheim
I have a "toy" version of Datalog working now here: http://code.google.com/p/clojure-datalog/ By "toy" I mean it works but is incredibly slow and wasteful. I would not use it in a production system. "Real" Datalog is coming, but I'm now doing research regarding the correct approach. Note, th

Re: Clojure Naming Conventions

2009-02-21 Thread David Nolen
Thanks for the points. What I was thinking, was that for things like π, in Clojure (as in CL), perhaps it makes to sense to mark it like so: +pi+ On Sat, Feb 21, 2009 at 8:59 PM, Chouser wrote: > > On Sat, Feb 21, 2009 at 5:36 PM, David Nolen > wrote: > > My point is simply that whether someth

Re: Clojure Naming Conventions

2009-02-21 Thread Chouser
On Sat, Feb 21, 2009 at 5:36 PM, David Nolen wrote: > My point is simply that whether something is immutable or not has nothing to > do with how that data structure is being used in the program. > Naming conventions signify usage. You could write a pure Java > program and make it pretty darn fun

Directed Graphs for Contrib

2009-02-21 Thread Jeffrey Straszheim
As part of my Datalog work I'm putting together some directed graph algorithms, mostly things like finding strongly connected components, and building dependency stratifications (think topological sort but with the results groups in tiers of non-interdependent nodes). Anyhow, I'm thinking this stu

Re: arguments to dissoc and select-keys

2009-02-21 Thread David Nolen
> > On Feb 21, 5:58 pm, samppi wrote: > > Allowing dissoc and select-keys to accept both keys as arguments and > > as a collection would be nice, and backwards compatible. > > Nope - Collections can be keys. Ah the power of Clojure ;) The fact that (almost?) anything can be a key is a pretty lib

Re: nth with regex Matchers

2009-02-21 Thread Chouser
On Sat, Feb 21, 2009 at 1:34 PM, Frantisek Sodomka wrote: > > nth claims to also work on regex Matchers: > > user=> (doc nth) > - > clojure.core/nth > ([coll index] [coll index not-found]) > Returns the value at the index. get returns nil if index out of > bounds, nth th

Re: where is contrib?

2009-02-21 Thread Chouser
On Sat, Feb 21, 2009 at 12:25 PM, Frantisek Sodomka wrote: > > For example, lazy-cons is still present in: > combinatorics.clj > lazy_xml/with_pull.clj > monads/examples.clj lazy-xml is fixed as of rev 493. Thanks for the report, --Chouser --~--~-~--~~~---~--~~

Re: simple I/O issue

2009-02-21 Thread Rayne
It's due to a type hint Rich put in a couple revisions ago to reduce reflection in clojure.core. I've filed an issue for it, it will be worked out in time. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: dependencies + observers + java interop: how to?

2009-02-21 Thread Timothy Pratley
Hi Max, Clojure has watchers on IRefs which can do most of what you are describing. auto-agent by SS in contrib allows you to define formula which are automatically updated (inspired by cells - search for cells on lib page and group). This gives a simple rule system, leaving just the the GUI inte

Re: arguments to dissoc and select-keys

2009-02-21 Thread Rich Hickey
On Feb 21, 5:58 pm, samppi wrote: > Allowing dissoc and select-keys to accept both keys as arguments and > as a collection would be nice, and backwards compatible. Nope - Collections can be keys. > In any case, > ostensibly it should be consistent; otherwise, it's just an > idiosyncrasy in th

Re: arguments to dissoc and select-keys

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 5:31 PM, David Nolen wrote: > Oops, sorry. It seems weird to me that a function called select-keys would > take a single parameter and not a vector. Also, as you said, this does seem > like it would require some kind of check which would probably not worth the > tradeoff.

Re: arguments to dissoc and select-keys

2009-02-21 Thread David Nolen
Oops, sorry. It seems weird to me that a function called select-keys would take a single parameter and not a vector. Also, as you said, this does seem like it would require some kind of check which would probably not worth the tradeoff. Why not write a function called select-key that does what you

Re: arguments to dissoc and select-keys

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 5:07 PM, David Nolen wrote: > dissoc is like assoc. > If you want to use collections with dissoc you can always use apply. It's > not too much to type: > (def my-map {:first "Bob", :middle "Joe", :last "Smith"}) > (apply dissoc my-map [:first :middle]) I think you misunde

Re: simple I/O issue

2009-02-21 Thread Stephen C. Gilardi
On Feb 21, 2009, at 6:10 PM, Mark Volkmann wrote: Thanks the suggestion. That works! However, it seems to me that (read-line) should do the same thing. Is there a reason it doesn't? There were a couple of discussions about this recently: http://groups.google.com/group/clojure/search?group=cl

Re: Invoking Java method through method name as a String

2009-02-21 Thread Timothy Pratley
How embarrassing! This works much better: (defn str-invoke [method-str instance & args] (clojure.lang.Reflector/invokeInstanceMethod instance method-str (to- array args))) (let [ts "toString", ct "compareTo"] (println (str-invoke ts 5)) (println (str-invoke ct 5 4)) (println (str-invoke

Re: dotimes suggestion

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 5:01 PM, David Nolen wrote: > (defmacro again [n & body] > `(dotimes [~'_ ~n] ~...@body)) > (again 3 (println "Ho")) > On Sat, Feb 21, 2009 at 5:51 PM, samppi wrote: >> >> For now, I do: >> (dotimes [_ 3] (print "Ho")) >> >> But I also think it would be a nice, natural

Re: simple I/O issue

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 4:48 PM, James Reeves wrote: > > On Feb 21, 10:11 pm, Mark Volkmann wrote: >> (print "Enter your name: ") >> (flush) >> (def nm (read-line)) >> (newline) >> (println "Your name is" nm) >> >> The read-line throws java.lang.ClassCastException: >> clojure.lang.LineNumberingP

Re: arguments to dissoc and select-keys

2009-02-21 Thread David Nolen
dissoc is like assoc. If you want to use collections with dissoc you can always use apply. It's not too much to type: (def my-map {:first "Bob", :middle "Joe", :last "Smith"}) (apply dissoc my-map [:first :middle]) On Sat, Feb 21, 2009 at 5:58 PM, samppi wrote: > > Allowing dissoc and select-ke

Re: dotimes suggestion

2009-02-21 Thread David Nolen
(defmacro again [n & body] `(dotimes [~'_ ~n] ~...@body)) (again 3 (println "Ho")) On Sat, Feb 21, 2009 at 5:51 PM, samppi wrote: > > For now, I do: > (dotimes [_ 3] (print "Ho")) > > But I also think it would be a nice, natural addition. > > On Feb 21, 3:07 pm, Timothy Pratley wrote: > > +1

Re: arguments to dissoc and select-keys

2009-02-21 Thread samppi
Allowing dissoc and select-keys to accept both keys as arguments and as a collection would be nice, and backwards compatible. In any case, ostensibly it should be consistent; otherwise, it's just an idiosyncrasy in the language that people will have to deal with. I wonder what the reasoning is beh

Re: dotimes suggestion

2009-02-21 Thread samppi
For now, I do: (dotimes [_ 3] (print "Ho")) But I also think it would be a nice, natural addition. On Feb 21, 3:07 pm, Timothy Pratley wrote: > +1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: simple I/O issue

2009-02-21 Thread James Reeves
On Feb 21, 10:11 pm, Mark Volkmann wrote: > (print "Enter your name: ") > (flush) > (def nm (read-line)) > (newline) > (println "Your name is" nm) > > The read-line throws java.lang.ClassCastException: > clojure.lang.LineNumberingPushbackReader. > Should it do that? I just want to read from stdin

Re: Clojure Naming Conventions

2009-02-21 Thread David Nolen
My point is simply that whether something is immutable or not has nothing to do with how that data structure is being used in the program. Naming conventions signify usage. You could write a pure Java program and make it pretty darn functional. You would still want to mark values that are logical

Re: Clojure Naming Conventions

2009-02-21 Thread Phil Hagelberg
David Nolen writes: > The fact that the Clojure data structures are immutable and that some > of those data structures might be used logically constants are two > separate concerns. I don't understand what this means. What's the difference between using a value that doesn't change and using a v

simple I/O issue

2009-02-21 Thread Mark Volkmann
(print "Enter your name: ") (flush) (def nm (read-line)) (newline) (println "Your name is" nm) The read-line throws java.lang.ClassCastException: clojure.lang.LineNumberingPushbackReader. Should it do that? I just want to read from stdin. -- R. Mark Volkmann Object Computing, Inc. --~--~--

Re: dotimes suggestion

2009-02-21 Thread Timothy Pratley
+1 --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com Fo

Re: Clojure Naming Conventions

2009-02-21 Thread David Nolen
The fact that the Clojure data structures are immutable and that some of those data structures might be used logically constants are two separate concerns. When reading Clojure code, we've already internalized the fact that the data structures are immutable. Using a naming convention for a consta

ANN: Preliminary Clojure Support in Buildr

2009-02-21 Thread Daniel Spiewak
I'm pleased to announce preliminary (and very experimental) support for the Clojure AOT compiler and REPL within Apache Buildr (http:// buildr.apache.org). At present, this support is only available within my Git fork available here: git://github.com/djspiewak/buildr.git More specifically, Clojur

Re: clojure class hierarchy

2009-02-21 Thread Frantisek Sodomka
You can read: http://clojure.org/data_structures http://clojure.org/sequences and: http://en.wikibooks.org/wiki/Clojure_Programming Frantisek On 21 Ún, 22:24, linh wrote: > where can i find information about clojure's data-structure class > hierarchy? i would like to know how seq, map, list, v

Re: clojure class hierarchy

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 3:24 PM, linh wrote: > > where can i find information about clojure's data-structure class > hierarchy? i would like to know how seq, map, list, vector and set are > related. i'm new to clojure and i don't always understand the api doc. > a class hierarchy would make it ea

Re: Clojure Naming Conventions

2009-02-21 Thread Phil Hagelberg
Mark Volkmann writes: > As best I can tell Clojure doesn't have a convention for constant names. Everything that's not expected to be rebound at runtime (*special-variables*) is by definition a constant (with the exception of refs, agents, and atoms). You don't need a special "constant naming c

Should (pop nil) throw an exception?

2009-02-21 Thread Frantisek Sodomka
Hello! Currently, 'pop' throws an exception if the collection is empty: clojure.core/pop ([coll]) For a list or queue, returns a new list/queue without the first item, for a vector, returns a new vector without the last item. If the collection is empty, throws an exception. Note - not the

clojure class hierarchy

2009-02-21 Thread linh
where can i find information about clojure's data-structure class hierarchy? i would like to know how seq, map, list, vector and set are related. i'm new to clojure and i don't always understand the api doc. a class hierarchy would make it easier for me to understand what functions can be appied t

Re: Clojure Naming Conventions

2009-02-21 Thread David Nolen
+name+ is also in line with Common Lisp patterns http://www.cliki.net/Naming%20conventions On Sat, Feb 21, 2009 at 4:07 PM, Luc Prefontaine < lprefonta...@softaddicts.ca> wrote: > In our software, we use uppercase or +name+ as constant names. > Both Java and RUBY use uppercase, I think it's more

Re: Clojure Naming Conventions

2009-02-21 Thread Luc Prefontaine
In our software, we use uppercase or +name+ as constant names. Both Java and RUBY use uppercase, I think it's more a matter of taste what you decide to use. Ideally it should be obvious by looking at the name that some name is a constant name. Both of the above satisfy this criteria. Luc On Sat,

Re: Clojure Naming Conventions

2009-02-21 Thread Mark Volkmann
On Sat, Feb 21, 2009 at 2:47 PM, Howard Lewis Ship wrote: > > I'm kind of used to Java nowadays, where CONSTANTS_ARE_UPPERCASE. I'm > trying to figure out if Clojure has equivalent conventions. > > What I've seen: > > names-with-dashes instead of CamelCase Right. > *global* for global variable

structmap doc string

2009-02-21 Thread Mark Volkmann
The doc string for the structmap function is a little hard to understand because it refers to "keyvals", but that isn't one of the parameters. The parameters are s and inits, but neither is referenced in the doc string. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~

Clojure Naming Conventions

2009-02-21 Thread Howard Lewis Ship
I'm kind of used to Java nowadays, where CONSTANTS_ARE_UPPERCASE. I'm trying to figure out if Clojure has equivalent conventions. What I've seen: names-with-dashes instead of CamelCase *global* for global variables (?) Parameter name conventions (from Stu's book): val, coll, a, etc. What are t

arguments to dissoc and select-keys

2009-02-21 Thread Mark Volkmann
(def popsicle-map {:red :cherry, :green :apple, :purple :grape}) ; Note how the keys passed to dissoc are individual arguments. (dissoc popsicle-map :green :blue) ; -> {:red :cherry, :purple :grape} ; Note how the keys passed to select-keys are in a vector, not individual arguments. (select-keys

Re: generic functions update

2009-02-21 Thread mikel
On Feb 21, 2:03 pm, Dan Larkin wrote: > On Feb 21, 2009, at 2:23 PM, mikel wrote: > > > > > If there's interest in having models and generic functions in contrib, > > I'll get a contributor agreement to Rich. > > Aye there is, from me at least. I think about three people have expressed interes

Re: generic functions update

2009-02-21 Thread David Nolen
I'm interested as well. On Sat, Feb 21, 2009 at 3:03 PM, Dan Larkin wrote: > > On Feb 21, 2009, at 2:23 PM, mikel wrote: > > > > If there's interest in having models and generic functions in contrib, > I'll get a contributor agreement to Rich. > > > Aye there is, from me at least. > > > > > > --

Re: generic functions update

2009-02-21 Thread Dan Larkin
On Feb 21, 2009, at 2:23 PM, mikel wrote: > > > If there's interest in having models and generic functions in contrib, > I'll get a contributor agreement to Rich. > Aye there is, from me at least. --~--~-~--~~~---~--~~ You received this message because you are s

Re: generic functions update

2009-02-21 Thread mikel
On Feb 20, 9:39 pm, mikel wrote: > Taking Chouser's suggestion of using a proxy that implements the > IDeref interface, and overrides deref to provide access to a closed- > over atom, I rewrote generic functions without resorting to gen-class > or external Java files. That makes me happy; good

Re: Clojure Questions

2009-02-21 Thread Richard Lyman
>From the http://clojure.org/getting_started page: "Clojure is delivered in a zip file containing a single .jar, clojure.jar, a readme, the CPL license and the source code in a src subdirectory. It uses the ASM 3.0 bytecode library , and the current alpha distribution in

Re: structmap instance test

2009-02-21 Thread David Nolen
For example, with Spinoza: (def my-circle (make-instance circle)) (instance-of? my-circle circle) ; > true circle is just a struct. On Sat, Feb 21, 2009 at 2:09 PM, David Nolen wrote: > This not hard to implement. This exactly what Spinoza does. Feel free to > lift any of my code. > > > On Sat

Re: Invoking Java method through method name as a String

2009-02-21 Thread Richard Lyman
Thanks for the quick response! :-) This works fine when the method name is not in a var, but if you try: user=> (defmacro my-invoke [method-str instance & args] `(. ~instance ~(symbol method-str) ~...@args)) nil user=> (my-invoke "toString" 5) "5" user=> (def command "toString") #'user/command u

Re: structmap instance test

2009-02-21 Thread David Nolen
This not hard to implement. This exactly what Spinoza does. Feel free to lift any of my code. On Sat, Feb 21, 2009 at 9:08 AM, Mark Volkmann wrote: > > Is there a way to test whether a given object is an instance of a > given structmap? > For example, > > (defstruct dog-struct :name :breed) > > (

Re: Clojure Questions

2009-02-21 Thread Christian Vest Hansen
I *think* that Clojure does not require anything from Java 6, and thus can work on any compliant Java 5 or greater. On Sat, Feb 21, 2009 at 3:13 PM, Sean wrote: > > Hi everyone, > I'm working on cleaning up the wikibook some, and I've got a few > questions. If anyone could answer, that would be

Fully qualified symbol name for instance methods?

2009-02-21 Thread pc
Hi, Would it be better/possible to allow a class prefix for instance calls? I.e., something like: (String/.toUpperCase s) The (String/.toUpperCase s) case would expand to (. #^String s toUpperCase). The current open dispatch form (.toUpperCase s) would still be accepted of course. The use of

Re: expansion of (.method obj)

2009-02-21 Thread Chouser
On Sat, Feb 21, 2009 at 1:48 PM, pc wrote: > > (macroexpand-1 '(.toUpperCase #^String s)) > ==> (. s toUpperCase) > > would it be better/possible to preserve type information? I.e., > > (macroexpand-1 '(.toUpperCase #^String s)) > ==> (. #^String s toUpperCase) It already does, but the repl by d

expansion of (.method obj)

2009-02-21 Thread pc
Hi, Currently: (macroexpand-1 '(.toUpperCase #^String s)) ==> (. s toUpperCase) would it be better/possible to preserve type information? I.e., (macroexpand-1 '(.toUpperCase #^String s)) ==> (. #^String s toUpperCase) Regards, -- pc --~--~-~--~~~---~--~~ You r

nth with regex Matchers

2009-02-21 Thread Frantisek Sodomka
nth claims to also work on regex Matchers: user=> (doc nth) - clojure.core/nth ([coll index] [coll index not-found]) Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for stri

Re: where is contrib?

2009-02-21 Thread Frantisek Sodomka
For example, lazy-cons is still present in: combinatorics.clj lazy_xml/with_pull.clj monads/examples.clj Frantisek On 21 Ún, 15:54, James Reeves wrote: > On Feb 21, 2:36 pm, bOR_ wrote: > > > Note that clojure just changed the lazy branch to be the main version > > of clojure, so right now cl

dotimes suggestion

2009-02-21 Thread Mark Volkmann
Currently the dotimes macro requires its first argument to be a vector for binding a variable to the number of times the body should be executed. Inside the body, that variable is bound to the values from 0 to that number minus 1. How about changing this macro to also accept an integer as the firs

Re: where is contrib?

2009-02-21 Thread James Reeves
On Feb 21, 2:36 pm, bOR_ wrote: > Note that clojure just changed the lazy branch to be the main version > of clojure, so right now clojure-contrib and the latest svn do not > play nicely yet. I belief there is a old version of clojure-contrib > available and probably also for clojure-main. All t

Optimizations

2009-02-21 Thread bOR_
Hi all. Recently started to optimize two models written in clojure, and I could use some tips from you guys. I first enabled the set reflection-warning thing, and removed reflections in the inner loop of my program. That already helped a lot, speeding up the whole thing to about 40% of its origi

Re: where is contrib?

2009-02-21 Thread bOR_
Note that clojure just changed the lazy branch to be the main version of clojure, so right now clojure-contrib and the latest svn do not play nicely yet. I belief there is a old version of clojure-contrib available and probably also for clojure-main. On Feb 21, 1:15 pm, Emeka wrote: > http://tel

Re: structmap instance test

2009-02-21 Thread Jason Wolfe
I don't think so. See http://groups.google.com/group/clojure/browse_thread/thread/74d430f8e4353725/ab7fe2144e09b56a?hl=en&lnk=gst&q=instance+defstruct#ab7fe2144e09b56a (and other threads on this issue too, IIRC.) Cheers, Jason On Feb 21, 6:08 am, Mark Volkmann wrote: > Is there a way to test

Clojure Questions

2009-02-21 Thread Sean
Hi everyone, I'm working on cleaning up the wikibook some, and I've got a few questions. If anyone could answer, that would be a great help. What is the minimum required JVM version for clojure? What versions of Java have been tested? What versions of Java are supported? Thanks! --~--~---

structmap instance test

2009-02-21 Thread Mark Volkmann
Is there a way to test whether a given object is an instance of a given structmap? For example, (defstruct dog-struct :name :breed) (def my-dog (struct dog-struct "Dasher" "whippet")) (when (some-function my-dog dog-struct) (println "It's a dog!")) -- R. Mark Volkmann Object Computing, Inc.

exclamation point at end of function names

2009-02-21 Thread Mark Volkmann
If I understand correctly, ending a function name with an exclamation point is a way to indicate that the function changes the value of one of its arguments. This is similar to the convention of ending function names with a question mark if they have a boolean result. Is there a reason that the r

Re: Invoking Java method through method name as a String

2009-02-21 Thread Timothy Pratley
Hi Richard, As you probably know, Clojure java interop requires the method to be a symbol: user=> (. 5 toString) "5" So if you want to invoke a method from a string, you can convert the string to symbol first: user=> (symbol "toString") toString Great! but (. 5 (symbol "toString")) wont work be

Re: how to emulate lisp's labels functionality?

2009-02-21 Thread Christopher Taylor
On 15.02.2009, at 06:26, Chouser wrote: > > On Sat, Feb 14, 2009 at 11:32 PM, GS wrote: >> >> On Feb 14, 12:21 pm, Chouser wrote: >>> >>> (defn count-instances [obj lsts] >>> (let [instances-in (fn thisfn [lst] >>> (if (seq lst) >>> (+ (if (= (fir

Re: Invoking Java method through method name as a String

2009-02-21 Thread pmf
On Feb 21, 8:31 am, Richard Lyman wrote: > I have an instance of the Java class in a variable. > I have the method arguments in a vector. > I have the method name as a String. > > I've tried so many different ways to invoke that method on that class and > pass those parameters. I've tried macros,

Re: where is contrib?

2009-02-21 Thread Emeka
http://telmanyusupov.wordpress.com/2009/02/16/basic-clojure-setup-part-1/ --~--~-~--~~~---~--~~ 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 To unsubscribe f

where is contrib?

2009-02-21 Thread Michi Oshima
My apologies for this post. I'm trying to locate and use clojure.contrib.command-line, but so far I am unable to find it. Where to fetch contrib? And how to use it? Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Invoking Java method through method name as a String

2009-02-21 Thread Richard Lyman
I have an instance of the Java class in a variable. I have the method arguments in a vector. I have the method name as a String. I've tried so many different ways to invoke that method on that class and pass those parameters. I've tried macros, reflection, and read/eval. None of the ways I've trie

Re: Feedback sought on yet another cells implementation!

2009-02-21 Thread Timothy Pratley
Hi Anand, Very interesting! Great to see so much cells activity, and yes for long chains lazy cells are great. My impressions: (1) auto-agents by SS in contrib has a more convenient syntax [maybe you can mimic it] (2) I can add a watcher to one of your cells - it wont do anything unless evaluate

Implementing the Associative interface

2009-02-21 Thread Jeff Rose
I'm building a storage layer where I'd like to access properties of an item as if it were a regular map. If I write a proxy that implements the Associative interface does this just work? Anyone know of some example Clojure code that is doing something similar? Thanks, Jeff --~--~-~-

Re: Feedback sought on yet another cells implementation!

2009-02-21 Thread Anand Patil
Hi all, My second attempt is lazy-cells.clj in this group's files. The cells are actual agents rather than ugly maps, and all the information about parents is hidden in watchers. If you change a cell, the cells that depend on it all change their values to {:needs-update true}. You can subsequent

ANSWER: Re: Is it possible to have Eclipse build an executable .jar with Clojure-dev

2009-02-21 Thread Laurent PETIT
It appears that someone created a useful Eclipse plugin to build executable jars from a java project. And it also works from a clojure-dev project ! I installed the Fat Jar plugin ( updatesite: http://kurucz-grafika.de/fatjar/ , homepage: http://fjep.sourceforge.net) and it worked well. The only