Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel
On Sep 23, 1:39 am, Nathan Sorenson n...@sfu.ca wrote: Just to clarify, you want to conj a vector to itself? i.e. [1 2 3 4] -- [1 2 3 4 [1 2 3 4]] I'm curious what the application of this is. Regarding the overhead of conj-ing to a vector: Clojure's data structures make use of structural

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread Andy Fingerhut
To be very precise, (conj v new-elem) is O(log n) in time and space, but it is constant-ish because the base of the logarithm is something like 32, rather than something like 2, so the constant factor multiplying the log n is typically pretty small. Also, there is no difference in Clojure's

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread Kevin Livingston
what's the actual use case where you want this? it seems pretty weird just on it's own. it may in practice be more clever than other solutions, but that's not clear yet. if you just want a unique symbol there's (gensym) regarding vectors, I found this a helpful read a while back, it's a few

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel
On Sep 23, 2:18 am, Andy Fingerhut andy.finger...@gmail.com wrote: To be very precise, (conj v new-elem) is O(log n) in time and space, but it is constant-ish because the base of the logarithm is something like 32, rather than something like 2, so the constant factor multiplying the log n is

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread Stefan Kamphausen
Hi, is there any particular reason not to use a Set instead of a vector? It solves the issue of distinct values. Or am I missing something? Regards, Stefan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Partitioning problem

2011-09-23 Thread Michael Jaaka
Hi! I have a sequence of natural numbers and I have to partition them into more or less equals N groups. Partitioning function is just a sum of numbers in a given group. My naive solution is to sort numbers descending then take each number and put into one of N groups in which sum of its

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Sam Aaron
On 23 Sep 2011, at 06:14, Glen Stampoultzis wrote: Ritz looks really nice the setup seems complicated. I haven't had much luck setting it up unfortunately. Me neither. Here's the steps I took so far: * Cloned https://github.com/pallet/ritz to a tmp dir * Copied the slime dir inside

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Scott Jaderholm
I don't think it looks for tools.jar specifically, it probably just uses the classes in there so as long as they're on the classpath you should be fine. I wouldn't worry about it unless you see an error saying it can't find some classes that googling reveals are in tools.jar. The README doesn't

How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Hello, I'm in the process of porting my code to Clojure 1.3. Those two pages were really helpful on the way: - http://dev.clojure.org/display/doc/Clojure+Contrib - http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go The only dependency I still couldn't get rid of is

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Hugo Duncan
On Fri, 23 Sep 2011 08:00:36 -0400, Sam Aaron samaa...@gmail.com wrote: On 23 Sep 2011, at 06:14, Glen Stampoultzis wrote: Ritz looks really nice the setup seems complicated. I haven't had much luck setting it up unfortunately. Hopefully we can simplify the process. The setup hasn't

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Hugo Duncan
On Fri, 23 Sep 2011 08:14:43 -0400, Scott Jaderholm jaderh...@gmail.com wrote: I don't think it looks for tools.jar specifically, it probably just uses the classes in there so as long as they're on the classpath you should be fine. I wouldn't worry about it unless you see an error saying

Re: How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread Stuart Sierra
Hi, Roman, In 1.3, you can use `with-redefs` to temporarily replace definitions. -Stuart Sierra clojure.com -- 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

Re: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Sierra
Hi Jochen, thanks for this report. It looks like the annotations tests are failing due to changes from JDK 1.6 to 1.7. They were brittle tests to begin with and should probably be removed or replaced. This also revealed to me that our JDK test builds on Hudson were not actually building

how to get the correct library????

2011-09-23 Thread jayvandal
I downloaded the contrib file that was indicated as the file containing (:use clojure.contrib.duck-streams)) but I get an error when trying to run code. I get errors but don't know what clojure is seeking?? Any advice will be appreciated -- You received this message because you are subscribed

Re: how to get the correct library????

2011-09-23 Thread Stuart Sierra
Hi Jayvandal, clojure.contrib.duck-streams is quite old. Since Clojure 1.2.0, most of the functionality of duck-streams has been packaged with Clojure itself in the clojure.java.io namespace. Please refer to http://dev.clojure.org/display/design/Clojure+Contrib for more information on what

Re: How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Thx Stuart, that worked fine ... -- 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

Re: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Halloway
Hi Jochen, thanks for this report. It looks like the annotations tests are failing due to changes from JDK 1.6 to 1.7. They were brittle tests to begin with and should probably be removed or replaced. This also revealed to me that our JDK test builds on Hudson were not actually

lein repl newbie question

2011-09-23 Thread labwork07
I like the lein repl. However, when I try to exit I get this error below. Any ideas? user= (System/exit 0) Exception in thread Thread-3 java.lang.RuntimeException: java.lang.IndexOutOfBoundsException at parsepcap.scrapeindex= (System/exit 0) Exception in thread Thread-3

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Sam Aaron
On 23 Sep 2011, at 14:24, Hugo Duncan wrote: I've not actually tried running ritz from cake recently. Which version of cake? 0.6.3 I've also not tried running with 1.3.0-RC0. I get the same issue (unknown task: ritz) with Clojure 1.2.0 I imagine this is some issue preventing the

Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Warren Wood
Ideally when generating a java class from Clojure for interop purposes, we should be able to generate any annotations that the equivalent java code could generate. Thus if a java class can annotate a constructor parameter, then gen-class and defrecord should be able to do that too. (I'm trying

Re: lein repl newbie question

2011-09-23 Thread Islon Scherer
Have you tried control+d? -- 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

:use :only support in ClojureScript now available

2011-09-23 Thread David Nolen
A lot people have been clamoring for this. This has been merged into master. (:use [foo.bar :only [...]]) (:use-macros [foo.bar :only [...]]) Are now both supported! Thanks to all that helped out! Cheers, David -- You received this message because you are subscribed to the Google Groups

aquamacs, slime and clojure on OS X

2011-09-23 Thread Jake Penton
Sorry to raise something that has probably been asked and answered umpteen times. I have been looking forward to trying clojure for quite some time. I appreciate that clojure and its ecosystem is undergoing rapid development. However, I have spent the last day and a half trying to get either

Why visible in-transaction changes?

2011-09-23 Thread Denis Washington
Hi, I really like the idea of grouping mutation in my programs into transactions in order to reduce the number of possible states make make reasoning about them easier (in the spirit of the mutable state discussion of [1]) and thought that Clojure's dosync + refs might be the ideal way to do

Re: Why visible in-transaction changes?

2011-09-23 Thread Stuart Halloway
I would have hoped that changes to refs during an transaction wouldn't affect the in-transaction value of the ref (that is, I would have liked the code to print 1, then 2). This way, the view of the program's state would always be guaranteed to be consistent, even during a transaction, and

Re: aquamacs, slime and clojure on OS X

2011-09-23 Thread Mark Rathwell
Intentionally avoiding leiningen on ideological grounds will make things more difficult and frustrating for yourself. If you do want to try it out, there are links below to get you started below. You can realistically be up and running with emacs and slime in less than an hour. lein:

Re: Partitioning problem

2011-09-23 Thread Chouser
On Fri, Sep 23, 2011 at 7:51 AM, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! I have a sequence of natural numbers and I have to partition them into more or less equals N groups. Partitioning function is just a sum of numbers in a given group. My naive solution is to sort numbers

Revelytix hiring Clojure developers

2011-09-23 Thread David McNeil
Revelytix [1] is hiring Clojure developers for full-time, direct employment in St. Louis, Missouri and Baltimore, Maryland USA. We are a relatively small team of developers building semantic technology based, data integration products. We understand that applicants may not have deep Clojure or

Re: Partitioning problem

2011-09-23 Thread Michael Jaaka
Good stuff! Thanks! Especially the trick with indexing so the set accepts first state of buckets. Beside this you are ignoring the current candidate computation along rest and just put him into nearest bucket. In mine I'm first looking for the potentially the best and finally put him over

Re: aquamacs, slime and clojure on OS X

2011-09-23 Thread Phil Hagelberg
On Thu, Sep 22, 2011 at 5:46 PM, Jake Penton jakepen...@gmail.com wrote: In the absence of reliable installation instructions (or perhaps even preferable to them), is there a description somewhere of the final target state that my system should be in? That is, I actually do NOT really want to

Re: Recursion/Algorithm Question

2011-09-23 Thread ax2groin
Thanks, That (along with returning the completed path via (list)) nailed it. I thought I'd tried concat at some point, but that might have been with another problem I've been tackling. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Partitioning problem

2011-09-23 Thread Alan Malloy
In the general case this is an NP-complete problem (ie, no algorithm you can write will be good enough), but many simpler cases can be solved quickly by some heuristic or other. See http://en.wikipedia.org/wiki/Partition_problem#Methods for some examples. On Sep 23, 4:51 am, Michael Jaaka

Re: aquamacs, slime and clojure on OS X

2011-09-23 Thread Justin Kramer
* install Leiningen * install the swank-clojure plugin: lein plugin install swank-clojure 1.3.2 * install clojure-mode (you can do this from git) * navigate to a project and do M-x clojure-jack-in That's all it takes. It might work with Aquamacs, but since that fork is not

Re: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Stuart Sierra
Hi Warren, Clojure doesn't try to be support every possible feature of Java when generating Java classes, it just provides enough for interop purposes. Annotations have always been a weak area. I don't know if annotations on constructor arguments in `gen-class` are supported, but my suspicion

Re: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Warren Wood
Excellent, thanks! And thanks for sharing the taxi from Strange Loop to STL tuesday night! :) On Sep 23, 2:07 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Hi Warren, Clojure doesn't try to be support every possible feature of Java when generating Java classes, it just provides

Re: Why visible in-transaction changes?

2011-09-23 Thread Denis Washington
Am 23.09.2011 17:25, schrieb Stuart Halloway: I would have hoped that changes to refs during an transaction wouldn't affect the in-transaction value of the ref (that is, I would have liked the code to print 1, then 2). This way, the view of the program's state would always be guaranteed to be

Re: ClojureScript: Problem getting Browser Repl Env to Work

2011-09-23 Thread Volker Schlecht
No unfortunately not, with neither FF nor Chrome, and using the Javascript Debuggers of both ... On Sep 21, 10:27 pm, David Nolen dnolen.li...@gmail.com wrote: Do you get any JS errors from the browser at the JS console? David On Wed, Sep 21, 2011 at 4:23 PM, Volker Schlecht

Re: ClojureScript: Problem getting Browser Repl Env to Work

2011-09-23 Thread David Nolen
Are you getting any missing resources errors? On Fri, Sep 23, 2011 at 4:03 PM, Volker Schlecht volker.schle...@gmail.comwrote: No unfortunately not, with neither FF nor Chrome, and using the Javascript Debuggers of both ... On Sep 21, 10:27 pm, David Nolen dnolen.li...@gmail.com wrote: Do

Re: Re: lein repl newbie question

2011-09-23 Thread labwork07
well, I was doing control+c which works too. How is control+d different? On , Islon Scherer islonsche...@gmail.com wrote: Have you tried control+d? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Re: lein repl newbie question

2011-09-23 Thread Islon Scherer
control+d exits clojure repl -- 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

Re: Re: lein repl newbie question

2011-09-23 Thread Bronsa
labwor...@gmail.com wrote: well, I was doing control+c which works too. How is control+d different? On , Islon Scherer islonsche...@gmail.com wrote: Have you tried control+d? -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Tarantoga
Deftype handles annotations and all the other features of java classes. Have a look here for an example: http://translate.google.com/translate?sl=autotl=enjs=nprev=_thl=enie=UTF-8layout=2eotf=1u=http%3A%2F%2Fmy-clojure.blogspot.com%2F2011%2F06%2Fweb-clojure.html On Sep 23, 10:11 pm, Warren Wood

Re: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Jochen Schmitt
Am 23.09.11 16:41, schrieb Stuart Halloway: Hi Jochen, thanks for this report. It looks like the annotations tests are failing due to changes from JDK 1.6 to 1.7. They were brittle tests to begin with and should probably be removed or replaced. This also revealed to me that our JDK test

Re: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Halloway
Hi Jochen, thanks for this report. It looks like the annotations tests are failing due to changes from JDK 1.6 to 1.7. They were brittle tests to begin with and should probably be removed or replaced. This also revealed to me that our JDK test builds on Hudson were not actually

[ANN] Clojure 1.3 Released

2011-09-23 Thread Christopher Redinger
We are pleased to announce today the release of Clojure 1.3: http://clojure.org/downloads For maven/leiningen users, your settings are now: :dependencies [[org.clojure/clojure 1.3.0]] This release includes many significant features and performance enhancements, documented here:

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel
On Sep 23, 2:20 am, Kevin Livingston kevinlivingston.pub...@gmail.com wrote: what's the actual use case where you want this? it seems pretty weird just on it's own.  it may in practice be more clever than other solutions, but that's not clear yet.  if you just want a unique symbol there's

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread Alan Malloy
On Sep 23, 3:02 pm, F Lengyel florian.leng...@gmail.com wrote: On Sep 23, 2:20 am, Kevin Livingston kevinlivingston.pub...@gmail.com wrote: what's the actual use case where you want this? it seems pretty weird just on it's own.  it may in practice be more clever than other solutions, but

Re: aquamacs, slime and clojure on OS X

2011-09-23 Thread MarisO
use this script to download everything you need for clojure development on emacs (aquamacs) git clone https://github.com/technomancy/clojure-mode.git wget -P framemove http://www.emacswiki.org/emacs/download/framemove.el wget -P paredit http://mumble.net/~campbell/emacs/paredit.el wget

Re: Why visible in-transaction changes?

2011-09-23 Thread Stefan Kamphausen
Hi, On Friday, September 23, 2011 5:25:34 PM UTC+2, stuart@gmail.com wrote: I would have hoped that changes to refs during an transaction wouldn't affect the in-transaction value of the ref you usually don't want that. When you start working on more than one value in a transaction (and

Re: aquamacs, slime and clojure on OS X

2011-09-23 Thread Durgesh Mankekar
+1 here. These instructions have worked for me with Aquamacs. On Sep 23, 2011, at 2:46 PM, Justin Kramer wrote: * install Leiningen * install the swank-clojure plugin: lein plugin install swank-clojure 1.3.2 * install clojure-mode (you can do this from git) * navigate to a project and do

Re: trace-forms macro

2011-09-23 Thread Luc Prefontaine
Hi Jonathan, I am moving the trace contrib stuff to 1.3. I would like to include your trace-forms macro in it. Feeling ok with this ? Comments ? The issues you underlined are not runtime errors, they are compilation errors. There's not much you can do to trap these. The macro is still valuable