Re: Google-collections

2009-12-30 Thread ajay gopalakrishnan
AFAIK, Clojure's persistent data structures resolve many of the scenarios where immutability is desired. Scenario in which I think immutability is highly desired are as follows: *Scenario 1*: Non-concurrency related reason. One of the non-concurrency related reason for immutability (I dont recall

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Rob Lachlan
Thanks very much, that makes a lot of sense. I looked through the java code for PersistentTreeMap, and indeed those methods are private. I think that I'll be happy with subseq and rsubseq. Being a noob, it hadn't occured to me that I could do that. On Dec 30, 8:04 pm, Timothy Pratley wrote: > 2

Google-collections

2009-12-30 Thread Vagif Verdi
I wonder if just released http://code.google.com/p/google-collections/ google-collections java library could be of any use to clojure implementation ? They have there "High-performance immutable implementations of the standard collection types" and many other goodies. -- You received this message

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Timothy Pratley
2009/12/31 Rob Lachlan : > About a year and a half ago, there was some discussion about having a > function that would enable some kind of bounded search on a sorted > Does this exist, currently?  I haven't looked at the gory details of subseq and rsubseq provide efficient bounded searching. I don

Re: leiningen javac plugin

2009-12-30 Thread Saul
On Dec 30, 8:46 pm, Rob Wolfe wrote: > Saul writes: > > Many thanks. This works for me and I find it useful. However, in a > > perfect world: > > > lein compile > > > would also compile my java source code or call compile-java before > > performing a compile. > If you mean something like Maven

Re: strange typecheck error

2009-12-30 Thread rzeze...@gmail.com
On Dec 30, 12:53 pm, Alex Ott wrote: > > If need, i can submit somebody full test case I think this might help because it's hard to tell what you are trying to do without a little more context. Some odd things that stand out to me: 1) You call loop, but you should be calling recur. E.g. (lo

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Rob Lachlan
Thanks for the pointer. I had a feeling that java world had something like this, but I'd much prefer to be able to do this from clojure. Appreciate the info, though. On Dec 30, 3:14 pm, Sean Devlin wrote: > Do you need persistence?  There's a solution in java.util in Java 6. > > On Dec 30, 6:10 

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Sean Devlin
Do you need persistence? There's a solution in java.util in Java 6. On Dec 30, 6:10 pm, Rob Lachlan wrote: > This would work, but would require iterating over the keys, for > something like O(n) performance.  I'm hoping that we can do better, > since the keys are already in an ordered collection

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Rob Lachlan
I should have said: since the keys are already in a tree. If they were in a linked list, I'd expect to have to iterate over most of the list. On Dec 30, 3:10 pm, Rob Lachlan wrote: > This would work, but would require iterating over the keys, for > something like O(n) performance.  I'm hoping th

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Rob Lachlan
This would work, but would require iterating over the keys, for something like O(n) performance. I'm hoping that we can do better, since the keys are already in an ordered collection. On Dec 30, 3:04 pm, Sean Devlin wrote: > Use a combination of take-while & key > > (take-while (comp your-pred k

Re: Status of bounded search on sorted-map?

2009-12-30 Thread Sean Devlin
Use a combination of take-while & key (take-while (comp your-pred key) sorted-map) You could also use drop while as needed. I've got a blog post where I use this to solve the knapsack problem: http://fulldisclojure.blogspot.com/2009/12/uses-for-takedrop-while.html I've got some other stuff, to

Re: seeking rudimentary defprotocol + deftype help

2009-12-30 Thread Rob Lachlan
Thanks alot guys! On Dec 30, 1:41 pm, Raoul Duke wrote: > p.p.s. i was using -alpha- and changed to -new- (and pulled today) and > now i get a slightly different error. am i just flubbing the syntax in > some way i can't see for the trees?! > > user=> (defprotocol P (foo [x])) > P > user=> (defty

Status of bounded search on sorted-map?

2009-12-30 Thread Rob Lachlan
About a year and a half ago, there was some discussion about having a function that would enable some kind of bounded search on a sorted map: http://groups.google.com/group/clojure/browse_thread/thread/949cae6c085d3d39/65b4082085c19a60?q= Does this exist, currently? I haven't looked at the gory

Re: seeking rudimentary defprotocol + deftype help

2009-12-30 Thread Raoul Duke
p.p.s. i was using -alpha- and changed to -new- (and pulled today) and now i get a slightly different error. am i just flubbing the syntax in some way i can't see for the trees?! user=> (defprotocol P (foo [x])) P user=> (deftype A [] [P] (.foo [x])) java.lang.RuntimeException: java.lang.ClassCast

Re: Clojure + Redis

2009-12-30 Thread Vagif Verdi
There are other NoSQL datastores written in java, like Voldemort. Perhaps if you investigate them, you will find one that will be much easier to integrate with clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: leiningen javac plugin

2009-12-30 Thread Rob Wolfe
Saul writes: > On Dec 9, 7:53 am, antoniogarrote > wrote: >> A quick and dirty hack to compile java files in clojure projects >> usingleiningen. >> >> >> Just run $lein compile-java to transforms 'src/**.java' into 'classes/ >> **.class' >> > > Many thanks. This works for me and I find it usefu

Re: merge doesn't work on deftypes implementing IPersistentMap

2009-12-30 Thread Allen Rohner
> i'm hoping the "yet" part means it is slated to maybe someday be upgraded? I've filed a bug and submitted a patch. Assuming my fix is acceptable, this should be in soon. https://www.assembla.com/spaces/clojure/tickets/231-deftype-cons-doesn-t-support-maps- -- You received this message because

Re: strange typecheck error

2009-12-30 Thread .Bill Smith
Sorry, I'm confused by the code sample. I see several loops but no corresponding recurs. On Dec 30, 11:53 am, Alex Ott wrote: > Hello all > > I have strange problem with type inference in Clojure.  I have following > code (simplified version of real code), > > (defn- process-char [#^InputStream

Re: seeking rudimentary defprotocol + deftype help

2009-12-30 Thread Raoul Duke
> Did you try: (deftype B [#^::A Avalue])? > I don't know whether this works, but it's the obvious idea. http://stackoverflow.com/questions/1976423/nested-types-in-clojure :-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: strange typecheck error

2009-12-30 Thread Nikolay Petrov
Is process char returns char or String? --Original Message-- From: Alex Ott Sender: clojure@googlegroups.com To: Clojure ML ReplyTo: clojure@googlegroups.com Subject: strange typecheck error Sent: Dec 30, 2009 19:53 Hello all I have strange problem with type inference in Clojure. I have

strange typecheck error

2009-12-30 Thread Alex Ott
Hello all I have strange problem with type inference in Clojure. I have following code (simplified version of real code), (defn- process-char [#^InputStream istream] (let [ch (.read istream)] (if (= ch 10) "AAA" ch))) (defn- process-text [#^InputStream istream] (loop [

Re: leiningen javac plugin

2009-12-30 Thread Saul
On Dec 9, 7:53 am, antoniogarrote wrote: > A quick and dirty hack to compile java files in clojure projects > usingleiningen. > > > Just run $lein compile-java to transforms 'src/**.java' into 'classes/ > **.class' > Many thanks. This works for me and I find it useful. However, in a perfect worl

leiningen plugins and scripting

2009-12-30 Thread Saul
Hello, I'm moving a small project over from maven built scala to leiningen built clojure. One of the features that was available with the maven scala plugin was the ability to run scala scripts: mvn scala:script -DscriptFile=scripts/build_db.scala This is useful for doing project specific tasks

Re: Clojure + Redis

2009-12-30 Thread Robert Campbell
I think anything which lowers the impedance mismatch between Clojure data structures and a persistent store is worth investigating. I'd love to find an ACID, transactional store which accepts native structures. Right now I'm using CouchDB, and while JSON is close enough, it still requires a mapping

Clojure + Redis

2009-12-30 Thread Gabi
On first look, Redis and Clojure seems to be a perfect match. They both handle sets and maps efficiently. If one could find an easy way to store and retrieve Clojure data structures to Redis (even a small subset- just a list or a set), a distributed clojure app could be very easy (and effective?) t

Re: Getting started with few Java knowledge

2009-12-30 Thread Joop Kiefte
I already tried fat jar, but failed... 2009/12/29 Laurent PETIT : > On the counterclockwise main page : > http://code.google.com/p/counterclockwise/ , > > There's a right box named "Groups" where you'll find the user & developers > group. > > For your particular problem, you can also check the ccw

clojure positions available

2009-12-30 Thread Stuart Halloway
More specifically "Developer positions with a major Clojure focus at our Durham, NC, USA office." Relevance is also doing a lot of Ruby, plus some C, Java, and a smattering of other things. Learn more about Relevance at http://howwework.thinkrelevance.com/. If you are interested tell us abou

Re: update-in and get-in why no default?

2009-12-30 Thread Timothy Pratley
On Dec 13, 1:24 am, Rich Hickey wrote: > fnil seems to me to have greater utility than patching all functions > that apply functions with default-supplying arguments. Neat :) I like it. > The get-in function could be enhanced, and would mirror get. Should I interpret 'could' as 'patch welcom

Re: Processing list more elegantly

2009-12-30 Thread Timothy Pratley
2009/12/30 Rich Hickey : > This was discussed before, the new version never made it into a patch: > http://groups.google.com/group/clojure/msg/43de40f078a291cc Great! The 'old' reductions behaves slightly different from the 'new' reductions for the 3 argument form: foo=> (reductions + 0 [3 5

Re: popping optional args from the front

2009-12-30 Thread Konrad Hinsen
On 30 Dec 2009, at 02:36, Joost wrote: > Personally, I prefer to use multple "prototypes": > > (defn bla > ([aaa bbb ccc] ) > ([bbb cc] (bla 0 bbb cc))) > > etc. That's the preferred approach for me too, but it doesn't work for functions that take a variable number of arguments. Konrad.