Re: Creating an object given a class object

2010-01-11 Thread Konrad Hinsen
On 11 Jan 2010, at 23:09, .Bill Smith wrote: Every class object has a newInstance method: user=> (Class/forName "java.util.HashMap") java.util.HashMap user=> (.newInstance (Class/forName "java.util.HashMap")) # user=> Is that what you are looking for? It seems close, but it doesn't work for

Help needed regarding the "let"

2010-01-11 Thread Manish
Hi, I am new to clojure, A small help is needed regarding the "let". (defn objectTest [ ] (let [buffer (StringBuilder.)] (do (.append buffer "manish") (println "After adding first word: " (.substring buffer 0)) ; --> Setting the value of the buffer t

Re: Lift and bind (was: Understanding the continuation monad's bind operator)

2010-01-11 Thread jim
You know, I think you're right. I would refer you to part 2 of Konrad's monad tutorial, but the link is broken. Check google's cache, if you want to read an explanation immediately. I'll have to go change that. Thanks for pointing it out and sorry for any confusion. Jim Steven E. Harris wrote: >

Lift and bind (was: Understanding the continuation monad's bind operator)

2010-01-11 Thread Steven E. Harris
Konrad Hinsen writes: > For a function of a single argument, m-lift and m-fmap are equivalent. In Jim Duey's essay Higher Level Monads¹, he writes the following on the lift operator: ,[ m-lift ] | If you have a function that you would like to turn into a monadic | function, that is a functi

Re: Contrib Logging change

2010-01-11 Thread Phil Hagelberg
Chris Dean writes: >> I really like the clojure.contrib.logging library, but I find myself >> often getting tricked into thinking it works like println: > > My $0.02: Checking the the type of the last arg seems too dwim to me, > but it will certainly work. I've been thinking recently that > info

Re: Contrib Logging change

2010-01-11 Thread Chris Dean
> I really like the clojure.contrib.logging library, but I find myself > often getting tricked into thinking it works like println: Nice idea. My $0.02: Checking the the type of the last arg seems too dwim to me, but it will certainly work. I've been thinking recently that info/warn/etc should

Re: FleetDB: A schema-free database implemented in Clojure

2010-01-11 Thread Mark McGranaghan
I've posted the slides here: http://fleetdb.org/talks/2010_01_07_ba_clojure_user_group.pdf On Jan 4, 6:35 pm, Mark McGranaghan wrote: > Sure; if someone at the meetup wanted to record the talk that would be > great. I'll probably publish my slides as well. > > - Mark > > On Jan 4, 6:18 pm, Sean

Re: Neo4j and clojure which project to use

2010-01-11 Thread Matt Revelle
I'd recommend http://github.com/pelle/clojure-neo4j. It's a fork of my repository which is a fork of JulianMorrison's (dead?) neo4j- clojure. Any changes made by pelle will make it back to my repository, but as he is actively developing his fork you're best bet is to track his. -Matt On Jan 11,

Re: Contrib Logging change

2010-01-11 Thread Mark Derricutt
+1 from me. Using (info (str xx xx xxx)) seems wrong. -- Pull me down under... On Tue, Jan 12, 2010 at 12:09 PM, Phil Hagelberg wrote: > > I really like the clojure.contrib.logging library, but I find myself > often getting tricked into thinking it works like println: > >    (info "Doing a thin

Re: Contrib Logging change

2010-01-11 Thread Timothy Pratley
2010/1/12 Phil Hagelberg : > Attached is a patch altering the logging library to behave this way by > accepting var-args and treating the last one as a throwable if applicable. > What do you think? Do other people have the same problem I do? Excellent idea. +1 from me. -- You received this messag

Re: Contrib Logging change

2010-01-11 Thread Richard Newman
What do you think? Do other people have the same problem I do? I just define much the same macros that you do :) I rarely log a Throwable, so I don't complicate my macros to do that. I just switch to (log :info (str ...) my-throwable) in that instance. -- You received this message because yo

Contrib Logging change

2010-01-11 Thread Phil Hagelberg
I really like the clojure.contrib.logging library, but I find myself often getting tricked into thinking it works like println: (info "Doing a thing with a vector: " my-vec) or (catch Exception e (warn "Problem doing a thing with: " my-vec e)) Attached is a patch altering the log

Re: clojure box "value as variable is void ?"

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 5:36 PM, brian wrote: > > (setq swank-clojure-classpath > > (list “c:/dev/project/src” “c:/dev/my-lib.jar”)) > > > > and I get this error when I bring clojure box up: > > Warning (initialization): An error occurred while loading `c:/Documents and > Settings/brian/.emacs':

Re: Clojure Box 1.1

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 3:49 PM, Chris Jenkins wrote: > Out of curiosity, what configuration do you have in place that's causing >> clojure.contrib.pprint to be loaded? >> >> > I'm not sure - all I did was to install Clojure Box and then I immediately > saw the error message when it started up. D

clojure box "value as variable is void ?"

2010-01-11 Thread brian
Hi all, I just installed Clojure Box, for me, marvelous! Everything works as described except one small problem though, following these directions from the readme.rtf: " You can also add jars or source directories from custom locations by adding them to your classpath in in your .emacs. To

Re: Clojure Box 1.1

2010-01-11 Thread Chris Jenkins
I have managed to get it to work now. The solution was to ensure that the Sun JRE was on the system PATH, rather than the IBM one. The IBM JRE seems to have a problem with the class file clojure/contrib/pprint/PrettyWriter.class in clojure-contrib.jar ...whereas the Sun one doesn't. The next que

Re: Neo4j and clojure which project to use

2010-01-11 Thread Tobias Ivarsson
If you don't get any answers here, I would suggest trying the Neo4j mailing list, the sign up page is at https://lists.neo4j.org/mailman/listinfo/user Cheers, Tobias On Mon, Jan 11, 2010 at 5:32 PM, pl6306 wrote: > Hi All, > > I am new to Clojure and Neo4j. I see a couple of different wrappers

Re: Clojure Box 1.1

2010-01-11 Thread Mark Fayngersh
Did you install it as administrator? Perhaps it had permission trouble setting the environmental variables. On Mon, Jan 11, 2010 at 3:49 PM, Chris Jenkins wrote: > Out of curiosity, what configuration do you have in place that's causing >> clojure.contrib.pprint to be loaded? >> >> > I'm not sur

Re: array equality

2010-01-11 Thread Laurent PETIT
Since arrays are not immutable, it's certainly wise to only consider equality to be based on java object identity ? At least I remember Rich mentioning this rationale, which sounds reasonable to me. 2010/1/11 Stuart Halloway : > clojure.core/= handles strings and seqs, but not arrays: > > (apply =

Re: Creating an object given a class object

2010-01-11 Thread .Bill Smith
Every class object has a newInstance method: user=> (Class/forName "java.util.HashMap") java.util.HashMap user=> (.newInstance (Class/forName "java.util.HashMap")) # user=> Is that what you are looking for? On Jan 11, 4:03 pm, Konrad Hinsen wrote: > Is there a way to create a new object by call

clojure.lang.Reflector.invokeMatchingMethod and type hints within macros

2010-01-11 Thread jpraher
Hi all, first of all kudos to clojure. Especially the clojure-swank in combination with leinigen is a nice environment to work with. Now to my problem: I am playing with JDI to intercept events of an attached JVM via clojure. Since there are a lot of siblings eventrequest subinterfaces, which can

Re: Clojure Box 1.1

2010-01-11 Thread Chris Jenkins
> > Out of curiosity, what configuration do you have in place that's causing > clojure.contrib.pprint to be loaded? > > I'm not sure - all I did was to install Clojure Box and then I immediately saw the error message when it started up. Do you know how I could learn more about the configuration? C

Creating an object given a class object

2010-01-11 Thread Konrad Hinsen
Is there a way to create a new object by calling its java constructor given just the class object? The new form doesn't do the job, as it requires a symbol naming the class. But I can't find anything else on the Java interop page... Is this impossible? Konrad. -- You received this message

Re: possible addition to duck-streams: input-stream

2010-01-11 Thread B Smith-Mannschott
On Mon, Jan 11, 2010 at 21:52, Stuart Halloway wrote: > contrib duck-streams has reader, but not an analogous input-stream. I find > myself having a byte-level interop need for it. > > Welcome contribution? Your wish. My command. ;-) http://bpsm.github.com/clojure-contrib-ducks-byte.html I mail

possible addition to duck-streams: input-stream

2010-01-11 Thread Stuart Halloway
contrib duck-streams has reader, but not an analogous input-stream. I find myself having a byte-level interop need for it. Welcome contribution? Stu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

array equality

2010-01-11 Thread Stuart Halloway
clojure.core/= handles strings and seqs, but not arrays: (apply = ["A" "A"]) => true (apply = (map #(.getBytes %) ["A" "A"])) => false (apply = (map #(seq (.getBytes %)) ["A" "A"])) => true I know how this happens, but not why. Is it a motivated design choice, or would a patch be welcome?

Re: Clojure Box 1.1

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 2:01 PM, Chris Jenkins wrote: > PS: FYI here's the full text that I see in my *inferior-lisp* buffer: > > (require 'swank.swank) > > (swank.swank/ignore-protocol-version nil) > > (do (.. java.net.InetAddress getLocalHost getHostAddress) > nil)(swank.swank/start-server > "c

Allow reduce to use the IReduce interface on non chunked seqs?

2010-01-11 Thread Dharkael
reduce no longer uses the IReduce interface on except on chunked sequences perhaps it could be changed to once again take of this on things like PersistentList and Range. something like: (defn reduce ([f coll] (let [s (seq coll)] (if s (reduce f (first s) (next s)) (f

Re: Clojure Box 1.1

2010-01-11 Thread Chris Jenkins
Incidentally, I just tried Clojure Box 1.0 on the same machine and get exactly the same error message. Very odd. One thing that may be unusual about my setup is that I am using IBM JDK 1.6 (although I have managed to get Clojure + SLIME working on Linux using this JDK). Anyone have any ideas? 2010

Clojure Box 1.1

2010-01-11 Thread Chris Jenkins
Hi, I downloaded Clojure Box 1.1 from here http://clojure.bighugh.com/, installed it and tried running it on Windows XP. Emacs starts ok and I get an *inferior-lisp* buffer but I see the following error message: user=> user=> java.lang.Exception: No such var: swank.swank/ignore-protocol-version (

Re: reader and "s

2010-01-11 Thread Raoul Duke
> Perhaps the problem is when you print the form after it's been > read? If you're using 'print' or 'println', strings are printed > without their double-quotes. Try using 'pr' or 'prn' instead. thanks, that sounds quite likely! -- You received this message because you are subscribed to the Goo

Re: clojure-contrib 1.1.0 Release Candidate 2

2010-01-11 Thread Stuart Sierra
On Jan 11, 4:33 am, Mark Derricutt wrote: > Stuart - are these RC builds available in any maven repository at all? Tim Dysinger and I are working on setting up a release repository for Clojure & contrib, sync'd to central. -SS -- You received this message because you are subscribed to the Googl

Neo4j and clojure which project to use

2010-01-11 Thread pl6306
Hi All, I am new to Clojure and Neo4j. I see a couple of different wrappers for neo4j http://github.com/ato/clojars-web#readme http://github.com/JulianMorrison/neo4j-clojure/ http://github.com/rosejn/clj-libs http://github.com/mattrepl/clojure-neo4j http://github.com/pelle/clojure-neo4j does

Re: Has anyone got the Enclojure NetBeans plugin working with clojure 1.1?

2010-01-11 Thread nwalex
Thanks Eric, appreciate the offer. I'm going to stick with Emacs for now. I'm quite enjoying getting to grips with it. On 11 Jan, 00:15, Eric Thorsen wrote: > I use several different builds (clojure platforms for the plugin) and do not > have any problems. > I'd be happy to get you past any issue

Re: clojure-contrib 1.1.0 Release Candidate 2

2010-01-11 Thread Mark Derricutt
Looks like I've actually refactored out the usage of clojure-contrib I had anyway, so its not too much of an issue currently now. -- Pull me down under... On Mon, Jan 11, 2010 at 10:33 PM, Mark Derricutt wrote: > Thou I suspect clojure-contrib 1.1 will be released by then...  I hope? -- You rec

Re: How do I extend an existing function to take different number of params?

2010-01-11 Thread Meikel Brandmeyer
Hi, On Jan 10, 7:45 am, Tom Faulhaber wrote: > Actually this is possible. (seehttp://xkcd.com/386/) I still don't think it's possible. You just modify the Var to contain a different object, which proxies to the original one. This is basically what I suggested - just a little nicer. The functio

Re: Trouble with running in jline editor. (newbie question)

2010-01-11 Thread Jay Donnell
I had similar problems when I tried to use it and I simply used rlwrap instead of jline. Works great! http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_rlwrap On Jan 10, 6:08 pm, piscesboy wrote: > java version "1.6.0_17" > clojure 1.1.0 > > Running on

Re: newbie swank clojure emacs

2010-01-11 Thread brian
Thanks for this, this is very cool indeed! Eric Lavigne wrote: Since you are using Windows, you may find Clojure Box easier to install. http://clojure.bighugh.com/ I followed the riddell.us/.../slime_swank.html tutorial yesterday, and can confirm that it works well for Ubuntu. On Sun, Jan 10

Re: Trouble with running in jline editor. (newbie question)

2010-01-11 Thread Mark Rathwell
just for fun, try the command below to use java 1.5 instead. not sure what the problem is, the setup you describe should work fine, and does work fine for me. i've had some problems with java 1.6 on mac, not these problems though, but worth a try. /System/Library/Frameworks/JavaVM.framework/Vers

Re: clojure-contrib 1.1.0 Release Candidate 2

2010-01-11 Thread Shantanu Kumar
A proper type Maven repo (whichever location, but with proper naming) for Clojure and Contrib would be great - consistent for projects that depend on Maven for dependencies and builds. Regards, Shantanu On Jan 11, 2:33 pm, Mark Derricutt wrote: > Stuart - are these RC builds available in any mav

Re: clojure-contrib 1.1.0 Release Candidate 2

2010-01-11 Thread Mark Derricutt
Stuart - are these RC builds available in any maven repository at all? We're wanting to a release of polyglot-maven in about 2-3 days but can't release with SNAPSHOT references, and an RC "release build" would be better than a SNAPSHOT. Thou I suspect clojure-contrib 1.1 will be released by then.

Re: generating a fn with a body based on user inputs, possible?

2010-01-11 Thread tristan
Thanks for the notes Meikel, i'm a clojure newbie so this sort of advice in invaluable to me! On 8 Jan., 16:00, Meikel Brandmeyer wrote: > Hi, > > On Jan 8, 3:10 pm, tristan wrote: > > > I've been working on a problem where I want the user to be able to > > input an equation in infix notation wh

Re: How do I extend an existing function to take different number of params?

2010-01-11 Thread Amit Rathore
damn, that's true - just "old-fn# ~name" would work :) On Jan 10, 4:42 pm, Tom Faulhaber wrote: > Yup, this version would cover most cases in a simpler way. My goal > (for no particular reason except it entertained me) was to make > something that worked as much like defn as possible. Most of the