Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Stefan Rohlfing
Fantastic! Thanks again! On Nov 23, 3:50 pm, Benny Tsai wrote: > Indeed there is :) > > http://clojuredocs.org/clojure_core/clojure.core/cycle > > On Nov 23, 12:37 am, Stefan Rohlfing > wrote: > > > > > > > > > Hi Benny, > > > Your solution is much more elegant and flexible as my hacking of the

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Benny Tsai
Indeed there is :) http://clojuredocs.org/clojure_core/clojure.core/cycle On Nov 23, 12:37 am, Stefan Rohlfing wrote: > Hi Benny, > > Your solution is much more elegant and flexible as my hacking of the > core function! > > How would you implement 'pad-padding' (I like this name) if every item >

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Stefan Rohlfing
Hi Benny, This implementation looks great! If I could only find out what went wrong with my (not so elegant) solution... Stefan On Nov 23, 3:30 pm, Benny Tsai wrote: > Or, to put it all together into a modified partition: > > (defn my-partition >   ([n coll] >      (partition n n coll)) >   ([

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Stefan Rohlfing
Hi Benny, Your solution is much more elegant and flexible as my hacking of the core function! How would you implement 'pad-padding' (I like this name) if every item of the padding should be repeated in order, not only the last one? (defn pad-padding [padding] (concat padding (repeat padding)))

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Benny Tsai
Or, to put it all together into a modified partition: (defn my-partition ([n coll] (partition n n coll)) ([n step coll] (partition n step coll)) ([n step pad coll] (let [expanded-pad (concat pad (repeat (last pad)))] (partition n step expanded-pad coll user=> (my-p

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Benny Tsai
Sorry, pad-padding is a terrible name choice on my part :) Maybe something like "repeat-last" would be at least a little bit better. On Nov 23, 12:17 am, Benny Tsai wrote: > Since (repeat) returns a lazy sequence, and partition will only take > as many as is needed, I think you don't even have t

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Benny Tsai
Since (repeat) returns a lazy sequence, and partition will only take as many as is needed, I think you don't even have to specify how many times to repeat: user=> (partition 3 3 (repeat "a") [1 2 3 4 5 6 7]) ((1 2 3) (4 5 6) (7 "a" "a")) And if the desired behavior is to repeat the last element o

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Stefan Rohlfing
Hi Meikel, What I want to accomplish is to have the function 'fill the gap' if not enough padding is supplied. With the standard 'partition' function this does not work, as it only adds as much padding as provided: (partition 3 3 ["a"] [1 2 3 4 5 6 7 8 9 10]) ;; ((1 2 3) (4 5 6) (7 8 9) (10 "a")

Re: Problem adjusting the implementation of 'partition'

2010-11-22 Thread Meikel Brandmeyer
Hi, while not having looked at your code, partition does what you want: user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7]) ((1 2 3) (4 5 6) (7 "a" "a")) user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7 8]) ((1 2 3) (4 5 6) (7 8 "a")) user=> (partition 3 3 (repeat 3 "a") [1 2 3 4 5 6 7 8 9])

Problem adjusting the implementation of 'partition'

2010-11-22 Thread Stefan Rohlfing
Dear Clojure Group, I am trying to adjust the implementation of the 'partition' function so that the last element of a provided padding such as ["a" "b"] will be repeated if necessary to ensure the length of the last list returned by 'padding' is the same as the other lists. This is the original

Re: clojure-contrib 1.3.0-alpha3 deployed to build.clojure.org

2010-11-22 Thread Michael Ossareh
On Mon, Nov 22, 2010 at 14:56, Benny Tsai wrote: > My guess is that they're being deprecated in favor of their > counterparts in clojure.core: > > string -> clojure.string > io -> clojure.java.io Ah right, I think I remember that now. Thanks! -- You received this message because you are subs

Re: ANN: Dr. Evil - the evil web debugger

2010-11-22 Thread Miki
Now in clojars as well, use [dr-evil "1.0.0-SNAPSHOT"] in your project.clj On Nov 21, 2:57 pm, Miki wrote: > Hello All, > > Dr. Evil is a simple web debugger that provides a REPL to your web > application in a "hidden" location. > > Usage is simple - add "EVIL" definition to your application > "d

Re: Clojure vs F# performance

2010-11-22 Thread Isaac Gouy
On Nov 22, 12:54 pm, Ralph wrote: > That is almost certainly true, since the Microsoft have probably done > extensive optimization on the CLR. > > On Nov 22, 1:18 pm, Mark Engelberg wrote: > > > I doubt that F# Mono benchmarks are representative of F#'s performance on > > Windows. If Microsof

Re: clojure-contrib 1.3.0-alpha3 deployed to build.clojure.org

2010-11-22 Thread Benny Tsai
My guess is that they're being deprecated in favor of their counterparts in clojure.core: string -> clojure.string io -> clojure.java.io On Nov 22, 2:49 pm, Michael Ossareh wrote: > On Sun, Nov 7, 2010 at 06:50, Stuart Sierra > wrote: > > >http://build.clojure.org/releases/org/clojure/contrib/

Re: Clojure vs F# performance

2010-11-22 Thread Isaac Gouy
On Nov 22, 10:18 am, Mark Engelberg wrote: > I doubt that F# Mono benchmarks are representative of F#'s performance on > Windows. Perhaps they are representative of F#'s performance on Mono on Windows :-) But I wouldn't take a bet on that - performance measurements can be very brittle. -- Y

Re: clojure-contrib 1.3.0-alpha3 deployed to build.clojure.org

2010-11-22 Thread Michael Ossareh
On Sun, Nov 7, 2010 at 06:50, Stuart Sierra wrote: > http://build.clojure.org/releases/org/clojure/contrib/ > > -- > 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 n

Re: Clojure vs F# performance

2010-11-22 Thread Ralph
That is almost certainly true, since the Microsoft have probably done extensive optimization on the CLR. On Nov 22, 1:18 pm, Mark Engelberg wrote: > I doubt that F# Mono benchmarks are representative of F#'s performance on > Windows. -- You received this message because you are subscribed to th

Re: Clojure vs F# performance

2010-11-22 Thread Ken Wesson
On Mon, Nov 22, 2010 at 2:29 PM, nicolas.o...@gmail.com wrote: >> Type hints don't reduce flexibility AT ALL. >> >> user=> (defn t1 [x] (.length x)) >> #'user/t1 >> user=> (t1 "foo") >> 3 >> user=> (t1 'foo) >> #> field found: length for class clojure.lang.Symbol >> (NO_SOURCE_FILE:141)> >> >> Sin

Re: Being "not Lisp" is a feature?

2010-11-22 Thread Daniel Gagnon
On Tue, Nov 16, 2010 at 3:59 PM, wrote: > Daniel Gagnon wrote .. > > I spoke to the guys on reddit. They said it is tongue-in-cheek. > > > They have no knowledge of functional programming > > ??? > > > but strongly feel it isn't suited to their field. > > ??? > > Isn't this a bit contrad

Re: Clojure vs F# performance

2010-11-22 Thread nicolas.o...@gmail.com
> Type hints don't reduce flexibility AT ALL. > > user=> (defn t1 [x] (.length x)) > #'user/t1 > user=> (t1 "foo") > 3 > user=> (t1 'foo) > # field found: length for class clojure.lang.Symbol > (NO_SOURCE_FILE:141)> > > Since it calls a String method it doesn't work if you call it with a > non-Str

Re: IDE and editors for Clojure

2010-11-22 Thread Ken Wesson
On Mon, Nov 22, 2010 at 1:32 PM, James Reeves wrote: > Aquamacs is just Emacs with its UI tweaked to act more like a native > OSX application. Gee, why don't Windows users get an emacs that acts enough like a Windows application not to unpleasantly surprise them if they're used to, say, NetBeans?

Re: with-meta vs ^{}

2010-11-22 Thread Ken Wesson
The main use I've had for with-meta is in macros, to attach e.g. type hints to a symbol that's going into the macro expansion. There, the ^ reader macro adds the metadata too early rather than with-meta adding it too late: ^ hints some symbol in the macro body and the compiler will apply the type h

Re: IDE and editors for Clojure

2010-11-22 Thread James Reeves
Aquamacs is just Emacs with its UI tweaked to act more like a native OSX application. - James On 22 November 2010 17:29, HB wrote: > I read that Rick is using Aquamacs, > What is the advantages of Aquamacs over Emacs+Slime? > > On Nov 22, 6:44 pm, Moritz Ulrich > wrote: >> My favorite is Emacs

Re: Clojure vs F# performance

2010-11-22 Thread Mark Engelberg
I doubt that F# Mono benchmarks are representative of F#'s performance on Windows. -- 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

Re: Clojure benchmark memory use and future improvements (Re: Clojure vs F# performance)

2010-11-22 Thread Ken Wesson
On Mon, Nov 22, 2010 at 11:47 AM, John Fingerhut wrote: >     max live=63.1 MB - The maximum heap size before any GC invocation >     was 63.1 MB.  The name "max live" is probably not the best name >     for that value, since objects in heap before a GC begins are often >     not all live. You'll

Re: Clojure vs F# performance

2010-11-22 Thread Ken Wesson
On Mon, Nov 22, 2010 at 10:10 AM, nicolas.o...@gmail.com wrote: > Clojure also offers an alternative to the full duck-typing/reflection scheme > while being more dynamic than interface: protocols. > > As many LISPs, it offers dynamicity with possible static typing > optimization when it is useful.

Re: IDE and editors for Clojure

2010-11-22 Thread HB
I read that Rick is using Aquamacs, What is the advantages of Aquamacs over Emacs+Slime? On Nov 22, 6:44 pm, Moritz Ulrich wrote: > My favorite is Emacs in combination with Slime. It features *great* > integration through Slime and nice extensibility. It's also a good thing > that Emacs is *made*

Re: with-meta vs ^{}

2010-11-22 Thread Laurent PETIT
2010/11/22 Mike K > In "Programming Clojure" Stuart Halloway says: > > It is important to note that the metadata reader macro is not the same > as with-meta. The metadata reader macro adds metadata for the > compiler, and with-meta adds metadata for your own data: > > (def ^{:testdata true} foo (

Re: ANN: Clojure Games

2010-11-22 Thread Daniel Kersten
Tim, if you want to take another shot at a logo, feel free! Ken, yeah, I forgot to remove the favicon and the twitter avatar. I guess I should do that. On 22 November 2010 14:30, Tim Visher wrote: > Hah.  There does seem to be some confusion about the logo. :) > > Oh well, it was still a neat li

Re: IDE and editors for Clojure

2010-11-22 Thread Laurent PETIT
Hi, I cannot but encourage you to give Eclipse's plugin (Counterclockwise) a try. Please note that since more and more of Counterclockwise internals itself is written in Clojure, one /could/ say that Counterclockwise is (more and more) *made* for programming in Clojure because it's written in Clo

Re: Cake build tool isn't functioning properly

2010-11-22 Thread David Nolen
On Mon, Nov 22, 2010 at 11:36 AM, HB wrote: > Hi, > I installed this Clojure Textmate bundle: > https://github.com/swannodette/textmate-clojure > and Cake build tool: > https://github.com/ninjudd/cake > > Running cake start in the terminal, I got these warnings (actually, > all Cake commands are

Clojure benchmark memory use and future improvements (Re: Clojure vs F# performance)

2010-11-22 Thread John Fingerhut
On Mon, Nov 22, 2010 at 5:00 AM, Ralph wrote: > On the Programming Languages Comparison Site (http:// > shootout.alioth.debian.org/u64/benchmark.php? > test=all&lang=clojure&lang2=fsharp), if you run the Clojure vs. F# > comparison, Clojure scores about the same in speed as F# (but does use > mor

Re: IDE and editors for Clojure

2010-11-22 Thread Moritz Ulrich
My favorite is Emacs in combination with Slime. It features *great* integration through Slime and nice extensibility. It's also a good thing that Emacs is *made* for programming in Lisp because it's written in a lisp (Emacs Lisp). On Mon, Nov 22, 2010 at 2:36 PM, HB wrote: > Hi, > I'm pretty sur

Cake build tool isn't functioning properly

2010-11-22 Thread HB
Hi, I installed this Clojure Textmate bundle: https://github.com/swannodette/textmate-clojure and Cake build tool: https://github.com/ninjudd/cake Running cake start in the terminal, I got these warnings (actually, all Cake commands are generating these warning): /Library/Ruby/Gems/1.8/gems/cake-

Re: with-meta vs ^{}

2010-11-22 Thread nicolas.o...@gmail.com
I think it is due to the fact that [1 2 3] is self-evaluating. If you were to write (defn f [x] ^{:order :ascending} x) (f [1 2 3]) the data would be on x in the compiler but never on [1 2 3] with-meta would do the right thing. On Mon, Nov 22, 2010 at 3:57 PM, Mike K wrote: > In "Programmin

with-meta vs ^{}

2010-11-22 Thread Mike K
In "Programming Clojure" Stuart Halloway says: It is important to note that the metadata reader macro is not the same as with-meta. The metadata reader macro adds metadata for the compiler, and with-meta adds metadata for your own data: (def ^{:testdata true} foo (with-meta [1 2 3] {:order :ascen

Re: Clojure vs F# performance

2010-11-22 Thread nicolas.o...@gmail.com
> At first this surprised me, since Clojure is dynamically typed, while > F# is statically typed. After some thought, however, it occurred to me > that Clojure can generate code very similar to statically typed > languages using type hints. Of course, as soon as you add type hints, > the code is no

Reusing Clojure libraries in Java/Jythom/Scala

2010-11-22 Thread Dilvan
Hi, During the discussions of the topic "Jython Interoperability problem", Mikhail Kryshen suggested implementations of Clojure data structures outside Clojure: >Clojure's data structures modified for use outside of Clojure: >http://github.com/krukow/clj-ds >Persistent analogue of the Java

Re: Clojure vs F# performance

2010-11-22 Thread Laurent PETIT
2010/11/22 David Nolen > On Mon, Nov 22, 2010 at 8:00 AM, Ralph wrote: > >> At first this surprised me, since Clojure is dynamically typed, while >> F# is statically typed. After some thought, however, it occurred to me >> that Clojure can generate code very similar to statically typed >> langua

Re: Destructuring noob question

2010-11-22 Thread Mark Rathwell
Probably would have been more clear if I showed an example in a function argument vector also: (defn foo {:count 2 :name "billy"}) (defn print-foo [{c :count n :name}] (println "count:" c "name:" n)) (print-foo foo) On Mon, Nov 22, 2010 at 9:30 AM, Mark Rathwell wrote: > > as for replacing

Re: ANN: Clojure Games

2010-11-22 Thread Tim Visher
Hah. There does seem to be some confusion about the logo. :) Oh well, it was still a neat little project to mess with. On Sun, Nov 21, 2010 at 10:08 PM, Ken Wesson wrote: > When I bring up the site, the new logo appears in the top left corner > but the tab still has the old favicon. > > -- > Yo

Re: Destructuring noob question

2010-11-22 Thread Mark Rathwell
as for replacing accessor methods: java: class Foo { private int count; private String name; public Foo(String name) { this.name = name; } public String getName() { return this.name; } public String getCount() { return this.count; }

Re: Clojure runtime instance in java process

2010-11-22 Thread Laurent PETIT
Hi Anton, Take a look at this, which was mentioned recently: https://github.com/ninjudd/classlojure (not used myself) HTH, -- Laurent 2010/11/22 Anton Dorozhkin > Thank you for your response. > > Everything is static in RT and Compiler classes, so different > ClassLoaders looks like to be t

Re: Destructuring noob question

2010-11-22 Thread nickik
as for first and next: You can do this (let [fst (first [1 2 3 4 5 6]) rst (rest [1 2 3 4 5 6])] (println "first: " fst) (println "rest: "rst)) or (let [[fst & rst] [1 2 3 4 5 6]] (println "first: " fst) (println "rest: "rst)) both print this: first: 1 rest: (2 3 4 5 6) --

Re: Clojure vs F# performance

2010-11-22 Thread David Nolen
On Mon, Nov 22, 2010 at 8:00 AM, Ralph wrote: > At first this surprised me, since Clojure is dynamically typed, while > F# is statically typed. After some thought, however, it occurred to me > that Clojure can generate code very similar to statically typed > languages using type hints. Of course,

Destructuring noob question

2010-11-22 Thread Andreas Kostler
Hi All, I'm currently ploughing my way through Michael Fogus and Chris Housers "The Joy of Clojure". I am currently reading up on destructuring. The authors sum up the chapter by concluding that destructuring is the idiomatic clojure replacement for accessor methods in OO languages. Can someone exp

IDE and editors for Clojure

2010-11-22 Thread HB
Hi, I'm pretty sure that this question is already been asked but failed to find it. What is your editor/IDE for Clojure? I didn't try them all, which IDE has the best Clojure support these days: IntelliJ, NetBeans or Eclipse? I'm not pretty happy with IntelliJ plugin. Thanks for help and time. --

Clojure vs F# performance

2010-11-22 Thread Ralph
On the Programming Languages Comparison Site (http:// shootout.alioth.debian.org/u64/benchmark.php? test=all&lang=clojure&lang2=fsharp), if you run the Clojure vs. F# comparison, Clojure scores about the same in speed as F# (but does use more memory). At first this surprised me, since Clojure is d

Re: benchmarking tipps and tricks

2010-11-22 Thread Sunil S Nandihalli
this might be a good place to start .. http://shootout.alioth.debian.org/ On Mon, Nov 22, 2010 at 4:45 AM, nickik wrote: > Hallo all, > > I know that what I'm asking here is not 100% about clojure but I hope > people in here can help me anyway. > > Me and a classmade of mine have to do a project

Re: Converting from 1.2 to 1.3-alpha3

2010-11-22 Thread nicolas.o...@gmail.com
> Yes, 1.3 supports only long and double primitives as local variables. > But the bug doesn't seem to be new. I get the same error if I try to > assign an int into a long deftype field in 1.2. > > So there is a bug in the way bad primitive assignement are reported or handled. Has it been reported

Re: Clojure vs Clisp...How big is the difference??

2010-11-22 Thread nicolas.o...@gmail.com
I agree that Common Lisp is big and it might take some time to learn. But it is not a waste of time either. It is an interesting language, and it is interesting to see the points of divergence with Clojure and understand them. However, it might not be the fastest path to Clojure. There are good bo