Re: Dividing list by predicate

2010-05-24 Thread ka
You may use reduce, as follows: (let [r (java.util.Random.) f (fn [el] (.nextBoolean r))] (def pred f)) (reduce (fn [m el] (let [k (pred el)] (assoc-in m [k] (conj (m k) el {true [] false []} (range 10)) Thanks -- You received this message beca

Re: NulPointerException when calling 'println' in 'if'

2010-05-24 Thread Meikel Brandmeyer
Hi, On Sun, May 23, 2010 at 10:37:29PM -0400, Timothy Washington wrote: > I wave a strange NullPointerException when I call (println "Some string"). > It seems similar to this problem on > Stackoverflow

Re: do clojure and la(tex) have something in common ?

2010-05-24 Thread Tim Daly
Actually, the main connection between lisp and latex is literate programming. You write a primary source document that contains your explanation and your code. You run "tangle" on the primary document to get source. You run "weave" on the primary document to get latex. In Axiom (the open source

Re: Error when tried to compile with C-c C-k in emacs.

2010-05-24 Thread Phil Hagelberg
On Sat, May 22, 2010 at 11:22 PM, Joost wrote: > On May 18, 9:38 pm, Robbie Vanbrabant > wrote: >> - use slime-connect and say yes on this: versions differ: nil (slime) vs. >> 20100404 (swank) continue? >> - works >> >> For completeness, I started from an emacs-starter-kit installation and then >

Re: Datatypes and Protocols update

2010-05-24 Thread Pedro Teixeira
On May 22, 9:51 pm, Pedro Teixeira wrote: > On Apr 27, 9:45 am, Rich Hickey wrote: > > > > > > > On Apr 27, 2010, at 3:20 AM, Mark Engelberg wrote: > > > > Watching Stuart's tutorial, it looks like the automaticfactory > > > functions for deftypes have gone away (I'm still working with Clojure

Re: Dividing list by predicate

2010-05-24 Thread Taliesin
This is a very useful predicate, I happened to write it myself for Mathematica just a few days ago. Speaking of which -- at some point I want to do a thorough comparison between Clojure and Mathematica, which in my opinion has some absolutely top-notch higher-order functions. Just as an example: F

matchure becoming clojure.contrib.match

2010-05-24 Thread Drew Colthorp
A few weeks ago I announced a pattern matching library called matchure. I'm excited to say it's being merged into clojure.contrib as clojure.contrib.match. I'd like some feedback on ideas for some backward-incompatible changes I'm planning to make before it's actually pushed to clojure.contrib. In

Re: any downside to putting everything into CLASSPATH?

2010-05-24 Thread Imran
Ok, so as long as I manage jar versions appropriately, there's not much to be gained by selectively including jars on the CLASSPATH. Just put them all in there. Thanks Stuart. On May 23, 6:54 pm, Stuart Campbell wrote: > > JVM newbie question here. Aside from the clojure & clojure-contrib jars,

Re: weird repl + classloader behavior

2010-05-24 Thread Erik Söhnel
Hi, I guess clojure creates a new classloader for each eval to make redefining deftypes possible. Is your requirement somehow related to applets or webstart or other sandboxes environments? > I need a reliable method to provide enforce usage of a single > classloader for an entire session, this a

Re: API in Clojure for Java folklore

2010-05-24 Thread Erik Söhnel
hi, you could use a simple class signature generator and then run javadoc on it: (def javadoc-strings (atom {})) (defn javadoc [class name & body] (swap! javadoc-strings update-in [class] #(conj (or % []) %2) [name (apply str body)]) nil) (defn -myMethod "My cool documentation" [x y]

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Heinz N. Gies
On May 24, 2010, at 5:41 , Drew Colthorp wrote: > A few weeks ago I announced a pattern matching library called > matchure. I'm excited to say it's being merged into clojure.contrib as > clojure.contrib.match. I'd like some feedback on ideas for some > backward-incompatible changes I'm planning t

Symetric function to prn

2010-05-24 Thread Michael Jaaka
Hello! I need symmetric function to prn (reads line of expression from binded *in* and constructs data structure - just like load-string does it now from a string). Right now I store data with prn to a file. Then read it with buffered reader and load-string. Reading in this case is very ineffect

Re: Symetric function to prn

2010-05-24 Thread Stuart Halloway
Isn't this just 'read' ? Stu Hello! I need symmetric function to prn (reads line of expression from binded *in* and constructs data structure - just like load-string does it now from a string). Right now I store data with prn to a file. Then read it with buffered reader and load-string. Read

Re: Symetric function to prn

2010-05-24 Thread Heinz N. Gies
Well read can (read) from a stream and if you don't serialize your data structure in one huge pile: [1] [1] [1] [1] vs. [[1] [1] [1] [1]] you can read it lazily. See http://github.com/Licenser/stupiddb/blob/master/src/stupiddb/core.clj#L75 for an example. regards, Heinz On May 24, 2010, at

Re: Dividing list by predicate

2010-05-24 Thread Sean Devlin
You can use drop-while, partition & iterate to implement fixed point rather easily in Clojure, FYI. http://vimeo.com/9460060 I show this at about the 9 minute mark. The code's uglized on git hub, will fix & post later. Sean On May 23, 5:27 pm, Taliesin wrote: > This is a very useful predicate

Re: Symetric function to prn

2010-05-24 Thread Michael Jaaka
Thank you clojure people!!! -- 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 thi

Re: NulPointerException when calling 'println' in 'if'

2010-05-24 Thread Timothy Washington
Ok, I solved this. What I had to do was put a '*do*' around the surrounding parent block (line 54). I only started looking at the surrounding block when I put en extra line of execution below my problem area (line 67), and saw the NullPointerException move down there. Now I understand the point tha

new initialization error - java.lang.ExceptionInInitializerError (control.clj:9)

2010-05-24 Thread Base
Clojure 1.2.0-master-SNAPSHOT java.lang.ExceptionInInitializerError (control.clj:9) Hi all - I am getting this error and cannot figure out where it is coming from. I am using Eclipse/CounterClockwise with Clojure 1.2.0-master-SNAPSHOT Coljure.contrib 1.2.0-master-SNAPSHOT and used labrepl as t

Protocol Level Constraints

2010-05-24 Thread Sean Devlin
Does anyone know how fn constraints interact w/ protocols? Can I specify them at the protocol level? Specifically, some kind of type/ class post constraint is what I'm interested in. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: new initialization error - java.lang.ExceptionInInitializerError (control.clj:9)

2010-05-24 Thread Stuart Halloway
Stack trace please! Clojure 1.2.0-master-SNAPSHOT java.lang.ExceptionInInitializerError (control.clj:9) Hi all - I am getting this error and cannot figure out where it is coming from. I am using Eclipse/CounterClockwise with Clojure 1.2.0-master-SNAPSHOT Coljure.contrib 1.2.0-master-SNAPSHOT

Re: API in Clojure for Java folklore

2010-05-24 Thread Jason Smith
It sure seems like we need a good stub generator for Clojure. Java- interop just doesn't seem complete without it. On May 22, 10:12 pm, ka wrote: > Hi, any responses? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, se

Re: weird repl + classloader behavior

2010-05-24 Thread Brent Millare
I am creating another dependency management system that using dynamic compilation to load dependencies during runtime. My actual issue is I needed to reconstruct the new effective classpath which should include the classpath given (from (System/getProperty "java.class.path")) at the commandline and

Re: any downside to putting everything into CLASSPATH?

2010-05-24 Thread Jason Smith
If you are interested, I have been working on a template project to let me create a REPL that comes preloaded with whatever JARs and AOT- compiled Clojure I want. Be warned - it's Maven! :-) and the REPL script is a BAT file for Windows - I haven't done anything with Unix yet. Wouldn't be hard

Re: new initialization error - java.lang.ExceptionInInitializerError (control.clj:9)

2010-05-24 Thread Base
Doh! User error :>| Thanks Stu for the help. Sorry to bother you. On May 24, 9:04 am, Stuart Halloway wrote: > Stack trace please! > > > > > Clojure 1.2.0-master-SNAPSHOT > > java.lang.ExceptionInInitializerError (control.clj:9) > > > Hi all - > > > I am getting this error and cannot figure ou

clojure date library

2010-05-24 Thread islon
I missed a date/time API in clojure so I made one myself. Is it possible to put it in clojure.contrib? Sugestions, critics and improvements are welcome. -> http://www.copypastecode.com/29707/ Islon -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: clojure date library

2010-05-24 Thread David Nolen
On Mon, May 24, 2010 at 1:53 PM, islon wrote: > I missed a date/time API in clojure so I made one myself. > Is it possible to put it in clojure.contrib? > Sugestions, critics and improvements are welcome. > > -> http://www.copypastecode.com/29707/ > > Islon > Have you looked at clj-time? http://

Language request: Passing metadata to a fn from its name (in a fn form)

2010-05-24 Thread joshua-choi
I have a language request for the fn special form. Functions can now have metadata. This is great, and very useful for me. I'd like to request that now the (fn name …) form pass on any metadata on the name symbol to the function itself: user=> (meta (fn ^{:a 3} name …)) {:a 3} This would ideall

Re: Language request: Passing metadata to a fn from its name (in a fn form)

2010-05-24 Thread Sean Devlin
It doesn't sound like your metadata is metadata any more. Should you be proxying AFn instead? On May 24, 3:24 pm, joshua-choi wrote: > I have a language request for the fn special form. > > Functions can now have metadata. This is great, and very useful for > me. > > I'd like to request that now

Re: clojure date library

2010-05-24 Thread Islon Scherer
Thanks for the link. I wasn't aware of this library. Islon On May 24, 3:10 pm, David Nolen wrote: > On Mon, May 24, 2010 at 1:53 PM, islon wrote: > > I missed a date/time API in clojure so I made one myself. > > Is it possible to put it in clojure.contrib? > > Sugestions, critics and improvemen

Re: Language request: Passing metadata to a fn from its name (in a fn form)

2010-05-24 Thread joshua-choi
I suppose I could, but that would make some things such as using letfn for my rules impossible when the rules are mutually recursive. In any case, it doesn't change the fact that, though functions now have metadata, there is no way to give functions defined letfn that metadata. This would be usefu

Re: Running Clojure scripts in Maven

2010-05-24 Thread Jason Smith
As a follow-up, the classloading feature talked about in this thread, along with a few extra features and improved documentation with examples is available in version 1.1.0.2. http://code.google.com/p/sandflea/wiki/MavenClojurePlugin The maven- clojure-plugin wiki page. I had been using GMaven:ex

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Antony Blakey
On 24/05/2010, at 1:11 PM, Drew Colthorp wrote: > A few weeks ago I announced a pattern matching library called > matchure. I'm excited to say it's being merged into clojure.contrib as > clojure.contrib.match. I'd like some feedback on ideas for some > backward-incompatible changes I'm planning t

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Stuart Halloway
Contrib (the license, provenance assurance, issue tracking) is one thing. Contrib (the monolithic deployment jar) is another. Historically they have been the same, but they don't have to be. Antony wants simple minimal dependencies. I want the provenance assurance, and the process that is (

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Phil Hagelberg
On Mon, May 24, 2010 at 2:33 PM, Stuart Halloway wrote: > Contrib (the license, provenance assurance, issue tracking) is one thing. > Contrib (the monolithic deployment jar) is another. > > Historically they have been the same, but they don't have to be. Antony > wants simple minimal dependencies.

Re: weird repl + classloader behavior

2010-05-24 Thread Jason Smith
Classloaders are generally additive. The system classloader pulls in standard Java libraries and anything else you specify on the command line. Then you can add classloaders, and they delegate back to the parent classloader as a default behavior. When you want to get rid of the JAR references fo

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Meikel Brandmeyer
Hi, On May 25, 2:33 am, Stuart Halloway wrote: > How can we get both? By providing a non-monolithic build? Once upon a time, I did this in a non-intrusive way using Ivy[1]. Back then the interest was close to zero. Now that contrib uses maven, this should be a non-brainer, no? Create a subproje

Re: matchure becoming clojure.contrib.match

2010-05-24 Thread Antony Blakey
On 25/05/2010, at 3:10 PM, Meikel Brandmeyer wrote: > Hi, > > On May 25, 2:33 am, Stuart Halloway wrote: > >> How can we get both? > > By providing a non-monolithic build? Yes, and ensuring that the subprojects use semantic versioning e.g. major version number increments on a non-backwards

Re: weird repl + classloader behavior

2010-05-24 Thread Brent Millare
Erik, what you said seems to make sense. So the question now is, since a new classloader is started during each eval at the repl, does that mean that it is closed after each repl statement? This seems to be the case because after requiring a namespace in a previous command at the repl, I can no lon

Re: do clojure and la(tex) have something in common ?

2010-05-24 Thread ka
Tim, I don't know much about either lisp or latex :). But it looks like a really neat idea at a first thought to me. Have two remarks- 1. From the developer's pov - I'm not sure how the developer, who is accustomed to looking at just code + some comments, will manage working with the book. But