what does cake bin do?

2011-09-13 Thread Sunil S Nandihalli
Hi Everybody, I have tried to use the AOT compilation via "cake bin" . I have seen that the AOTed "executable" takes about 14 to 15 seconds while when run at the repl it takes about 10 to 11 seconds. While I can attribute part of the extra time to the JVM start-up time and loading clojure .. I can

Re: Rounding the edges of an Emacs beginner

2011-09-13 Thread Thorsten Wilms
On 09/14/2011 05:20 AM, Timothy Washington wrote: But now that I think about it, I can probably just pass a run jetty / ring form to swank to start it :) Let me know if I'm on the right path. I recently started using clojure-jack-in. lein repl made it easy to automatically execute a startup s

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Stuart Campbell
I knew there must be a nicer way to write that :) On 14 September 2011 16:22, Meikel Brandmeyer (kotarak) wrote: > Or: > > (swap! user-queues update-in [k] (fnil conj > clojure.lang.PersistentQueue/EMPTY) v) > > Sincerely > Meikel > > -- > You received this message because you are subscribed to

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Meikel Brandmeyer (kotarak)
Or: (swap! user-queues update-in [k] (fnil conj clojure.lang.PersistentQueue/EMPTY) v) Sincerely Meikel -- 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 a

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Stuart Campbell
Hi Trevor, I hope I've understood your problem correctly. You can modify nested structures using e.g. update-in: (let [k "user1" v 1234] (swap! user-queues update-in k conj v)) That's assuming that a user queue already exists in the map. If it doesn't, you could do something like: (let

Re: run clj file get user/counter-app error?

2011-09-13 Thread Stuart Campbell
That line is the string representation of a Var. It isn't an error - it's just the return value of the expression you entered. (load-file) evaluates all expressions in a file and returns the value of the last one. In your case, it's the value of (defn counter-app [] ...), which defines the counter

Re: run clj file get user/counter-app error?

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 10:42 PM, jayvandal wrote: > I am running a  swing tutorial clojure program file and when I run the > result is > ++ > user=> (load-file "c:/clojure-1.2.1/counter-app.clj") > #'user/counter-app > user=> > +

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 10:43 PM, finbeu wrote: > But how do I use the connectionpool now from clojure.java.jdbc? Did you read that documentation? Does it not provide enough information? Let me know so I can make it better. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfi

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
Sean, thx for the hint. But how do I use the connectionpool now from clojure.java.jdbc? (defn db-update-or-insert "Updates or inserts a fruit" [record] (sql/with-connection db (sql/update-or-insert-values :fruit ["name=?" (:name record)] record))) In my scenario, I just

run clj file get user/counter-app error?

2011-09-13 Thread jayvandal
I am running a swing tutorial clojure program file and when I run the result is ++ user=> (load-file "c:/clojure-1.2.1/counter-app.clj") #'user/counter-app user=> ++ What does this line mean? #'user/counter-app The name of my fi

Re: Calling a Java call with array from Clojure

2011-09-13 Thread ron peterson
Thank you very much. Your suggestions worked: (.doSomething a "abc" (into-array String ["efg" "hij"])) On Sep 13, 7:33 pm, Alan Malloy wrote: > Varargs are a fiction of javac, and do not exist at the bytecode > level. In real life, this method takes two args, a String and a > String[]. Use into-

Re: Rounding the edges of an Emacs beginner

2011-09-13 Thread Timothy Washington
Oh nice one mate. Yes, I tried M-x clojure-jack-in. The main feature I'm looking for is to be able to run a jetty / compojure stack, then connect / jack-in to that. But now that I think about it, I can probably just pass a run jetty / ring form to swank to start it :) Let me know if I'm on the

Re: Rounding the edges of an Emacs beginner

2011-09-13 Thread Phil Hagelberg
On Tue, Sep 13, 2011 at 7:13 PM, Timothy Washington wrote: > ? getting an error when I i) "M-x slime-connect" or ii) send a form (+1 1) > to swank ; this is after i) a "lein swank" then ii) in another window > "emacs" M-x connect . ** Evaluating Slime forms seems to work after that Have you tried

Re: Calling a Java call with array from Clojure

2011-09-13 Thread Alan Malloy
Varargs are a fiction of javac, and do not exist at the bytecode level. In real life, this method takes two args, a String and a String[]. Use into-array to create a string array, and pass that as the second arg. On Sep 13, 6:21 pm, ron peterson wrote: > I have a following API call that I need to

Rounding the edges of an Emacs beginner

2011-09-13 Thread Timothy Washington
Hey all, So I'm still an avid vim user. But I see a lot of power in the swank slime setup, and have been teaching myself emacs to try to leverage it. There are still a few tricks I haven't got. Maybe my notes are just disorganised, but I was hoping fellow Clojurians can chime in. - ? gettin

Re: Calling a Java call with array from Clojure

2011-09-13 Thread Luc Prefontaine
My typos errors are horrible tonight, new laptop, new keyboard. So if you defined a variable argument Java method the String array should work. But I am not certain about the intent of ... in your code excerpt. On Tue, 13 Sep 2011 21:43:03 -0400 Luc Prefontaine wrote: > Oups I did read the code

Re: Calling a Java call with array from Clojure

2011-09-13 Thread Luc Prefontaine
Oups I did read the code entirely... you defined a varg method ? On Tue, 13 Sep 2011 21:34:33 -0400 Luc Prefontaine wrote: > user=> (class (into-array String ["s" "a"])) > [Ljava.lang.String; > > Luc P. > > > On Tue, 13 Sep 2011 18:21:31 -0700 (PDT) > ron peterson wrote: > > > I have a fol

Re: Calling a Java call with array from Clojure

2011-09-13 Thread Luc Prefontaine
user=> (class (into-array String ["s" "a"])) [Ljava.lang.String; Luc P. On Tue, 13 Sep 2011 18:21:31 -0700 (PDT) ron peterson wrote: > I have a following API call that I need to make from Clojure: > > class A > > doSomething(java.lang.String arg1, String... args) > > so I tried > > (def a

Calling a Java call with array from Clojure

2011-09-13 Thread ron peterson
I have a following API call that I need to make from Clojure: class A doSomething(java.lang.String arg1, String... args) so I tried (def a (new A)) ;this works (.doSomething a "abc" "efg" "hij") ;this doesn't work giving me no matching method found: doSomething for class A -- You received

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Trevor
Thanks for the quick responses. I'll try to answer Andy's question: "How do you know, in advance, that it doesn't need to handle such concurrent changes?" ... and at the same time I will try to provide this example to Stuart, hoping I can see how using a map inside an atom might work: Let's say m

Re: Macros in ClojureScript

2011-09-13 Thread David Nolen
You can reference macros defined in *clojure* files that are on your classpath like this: (ns my.namespace (:require-macros [my.macros :as my]) The ClojureScript compiler will use these macros to expand your ClojureScript source. Works great. David On Tue, Sep 13, 2011 at 6:31 PM, Timothy Ba

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Stuart Halloway
> For example, what if I have a hash-map that needs to handle concurrent > changes to the data structure, but never needs to have concurrent > changes to a given piece of data (i.e a key/value pair). Wouldn't > there be value in being able to modify the data "in-place" without > making a copy, or n

Re: N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Andy Fingerhut
To my knowledge, there are no built-in data structures that are mutable and that use the same access functions. There are built-in data structures called transients that are mutable, and use almost the same hash functions. Read the docs on transient, persistent!, conj!, etc. Transient data struc

Re: Macros in ClojureScript

2011-09-13 Thread Laurent PETIT
Hi, 2011/9/14 Timothy Baldridge > While working with ClojureScript I came across a interesting question. > When compiling cljs files, how does Clojure handle macros? Normally > macros are run at compile-time, but in this case the compile-time > platform is completely different than the run time

N00b alert! - A question on immutable/mutable data structures...

2011-09-13 Thread Trevor
For the most part, I *believe* I understand why immutable data structures with transactions are important to manage concurrent operations to shared data, but I often wonder why it matters in some cases... For example, what if I have a hash-map that needs to handle concurrent changes to the data st

Macros in ClojureScript

2011-09-13 Thread Timothy Baldridge
While working with ClojureScript I came across a interesting question. When compiling cljs files, how does Clojure handle macros? Normally macros are run at compile-time, but in this case the compile-time platform is completely different than the run time platform. My guess is that the compiler ass

Re: Clojure vs Scala - anecdote

2011-09-13 Thread Laurent PETIT
Oh, it was just one, after all ? Please, don't tell this to my boss :-D 2011/9/13 Meikel Brandmeyer > “Plan to throw one away.” > > -- > 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 >

Re: heaps in clojure

2011-09-13 Thread Jason Wolfe
There is java.util.PriorityQueue, which is heap-based: http://download.oracle.com/javase/1,5.0/docs/api/java/util/PriorityQueue.html -Jason On Sep 13, 4:44 am, Sunil S Nandihalli wrote: > Hi Everybody, >  I have a very large, but with finite size, collection. I would like to get > like first 1

Re: good ways to deal with compiler errors in SLIME (emacs)

2011-09-13 Thread Sergey Didenko
Thanks, Phil ! That's it. I was using "slime-load-file" instead of "slime-compile-and-load-file" If you compile using C-c C-k (where it sends the filename instead of > the contents of the file) then it can determine line numbering. > > -- You received this message because you are subscribed to

Re: Clojure vs Scala - anecdote

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 9:48 AM, Nathan Sorenson wrote: > I adore Clojure as well, but could this success not be partially due > to the "reimplementing for the second time" phenomenon? i.e. if you re- > wrote the entire thing in Scala again, perhaps you would see similar > gains in brevity etc? W

Re: Clojure vs Scala - anecdote

2011-09-13 Thread Meikel Brandmeyer
“Plan to throw one away.” -- 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

Re: Migration to 1.3 for mortals

2011-09-13 Thread Jan Rychter
On Sep 13, 1:44 am, Stuart Sierra wrote: > > Since the new, separated contrib libraries are supposed to be > > compatible with Clojure 1.2, you could perhaps also start migrating > > one lib at a time at your leisure.  This might even enable you to > > contribute to a migration document. > > Yes,

Re: Programmer Day

2011-09-13 Thread Chouser
On Tue, Sep 13, 2011 at 12:31 PM, Wilker wrote: > (println (apply str (map char [72 97 112 112 121 32 80 114 111 103 114 97 > 109 109 101 114 32 68 97 121 33]))) What kind of day is that, anyway? (let [m map, c comp, p partial, s str] (m (c symbol (p apply s) (p m (c char dec int)) s) '[i

Programmer Day

2011-09-13 Thread Wilker
(println (apply str (map char [72 97 112 112 121 32 80 114 111 103 114 97 109 109 101 114 32 68 97 121 33]))) --- Wilker Lúcio http://about.me/wilkerlucio/bio Kajabi Consultant +55 81 82556600 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Clojure vs Scala - anecdote

2011-09-13 Thread Laurent PETIT
Isn't it Brooks who said "you will throw it away at least 3 times", or something like this ? :) 2011/9/13 Nathan Sorenson > I adore Clojure as well, but could this success not be partially due > to the "reimplementing for the second time" phenomenon? i.e. if you re- > wrote the entire thing in S

Re: Clojure vs Scala - anecdote

2011-09-13 Thread Nathan Sorenson
I adore Clojure as well, but could this success not be partially due to the "reimplementing for the second time" phenomenon? i.e. if you re- wrote the entire thing in Scala again, perhaps you would see similar gains in brevity etc? On Sep 6, 10:32 pm, Sean Corfield wrote: > I just wanted to share

Re: [ANN] Clojure 1.3 RC0

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 6:02 AM, Christopher Redinger wrote: > Clojure 1.3 RC0 is now available at http://clojure.org/downloads > Changes since Beta 3: > * Optimization should not demote BigInts (CLJ-836) > * Added Intrinsics Could someone speak to this change since it didn't have an attached JIR

Re: good ways to deal with compiler errors in SLIME (emacs)

2011-09-13 Thread Phil Hagelberg
On Tue, Sep 13, 2011 at 1:55 AM, Sergey Didenko wrote: > How can I see the error line number in SLIME? Or even somehow place editor > point on the place of the error? > > However when I load this file in the SLIME repl it just prints: > > "Unable to resolve symbol: dd in this context If you compi

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Sean Corfield
On Tue, Sep 13, 2011 at 6:49 AM, finbeu wrote: > BTW: Does someone know how I can keep the connection always open? If I > understand it right, "with-connection" does a connect and login to the db > each time it gets called. Isn't this quite inefficient? Take a look at https://github.com/clojure/

[ANN] Clojure 1.3 RC0

2011-09-13 Thread Christopher Redinger
Clojure 1.3 RC0 is now available at http://clojure.org/downloads Changes since Beta 3: * Optimization should not demote BigInts (CLJ-836) * Added Intrinsics * fix nary-inline so *unchecked-math* works again Please download it and let us know how it works for you. 1.3 is getting close. -- You

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
oh yes. Now it works. Thanks for the quick response! BTW: Does someone know how I can keep the connection always open? If I understand it right, "with-connection" does a connect and login to the db each time it gets called. Isn't this quite inefficient? - Finn -- You received this message

Re: heaps in clojure

2011-09-13 Thread Chouser
On Tue, Sep 13, 2011 at 7:44 AM, Sunil S Nandihalli wrote: > Hi Everybody, >  I have a very large, but with finite size, collection. I would like to get > like first 10 elements in the sorted list . I would use a heap if I were in > c++ .. is there a inbuilt implementation of this in clojure? .. I

Re: ClojureScript for CouchDB

2011-09-13 Thread Pepijn de Vos
What needs to be done? Pepijn On Sep 13, 2011, at 2:30 PM, Stuart Sierra wrote: > Just an idea at the moment. We need more people with knowledge of CouchDB to > work on it. > > -Stuart Sierra > clojure.com > > -- > You received this message because you are subscribed to the Google > Groups "

Re: Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread Meikel Brandmeyer (kotarak)
Hi, comparing the two calls, I suppose you need apply. (def x [[5, "A", 2.0] [6 ,"B", 3.0]]) (sql/with-connection db_spec (apply sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] x)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Problem with insert-values (clojure.contrib.sql)

2011-09-13 Thread finbeu
Houston, I have a problem: (sql/with-connection db_spec (sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] [5, "A", 2.0] [6 ,"B", 3.0]) This works perfectly fine. Now I'm trying to do the following: (def x [[5, "A", 2.0] [6 ,"B", 3.0]]) (sql/with-connection db_spec

Re: ClojureScript for CouchDB

2011-09-13 Thread Stuart Sierra
Just an idea at the moment. We need more people with knowledge of CouchDB to work on it. -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 ne

Re: ClojureScript for CouchDB

2011-09-13 Thread Chas Emerick
First, what Herwig said. :-) Second, it's not outside of the realm of possibility that clutch might eventually be able to take .cljs files (or clojure/cljs source inline via clutch macro), invoke the cljs compiler, and use its existing functionality to upload the resulting view functions' code

Re: How to compose futures?

2011-09-13 Thread Stuart Sierra
I've been spending a lot of time on the continuations aspect: http://github.com/stuartsierra/cljque -S -- 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

Re: heaps in clojure

2011-09-13 Thread Jonathan Fischer Friberg
There is the inbuilt sort function, also sort-by is useful. In "The joy of clojure", there were an example of a lazy sort. It can be found here: http://www.manning.com/fogus/ In the file "q.clj" in the source code. Jonathan On Tue, Sep 13, 2011 at 1:44 PM, Sunil S Nandihalli < sunil.nandiha...@g

heaps in clojure

2011-09-13 Thread Sunil S Nandihalli
Hi Everybody, I have a very large, but with finite size, collection. I would like to get like first 10 elements in the sorted list . I would use a heap if I were in c++ .. is there a inbuilt implementation of this in clojure? .. Is there some other way to achieve this? some sort of lazy sort would

Re: ClojureScript for CouchDB

2011-09-13 Thread Herwig Hochleitner
Just a little remark: Keep in mind, that clutch https://github.com/ashafa/clutch comes with a CouchDB view server that can execute Clojure code. So compiling to JS only seems desirable to me, when you can't configure an additional view server on your CouchDB. Performance wise, it should make no big

ClojureScript for CouchDB

2011-09-13 Thread Pepijn de Vos
While reading about ClojureScript, I saw a couple of mentions of CouchDB as a use case for ClojureScript. Would anyone care to elaborate? Is this anything more than an abstract idea? There is no CouchDB compile target AFAIK, and I can't see how any of the others would work out of the box. The

Re: puzzlement over lazy sequences

2011-09-13 Thread Ken Wesson
On Tue, Sep 13, 2011 at 4:18 AM, Stefan Kamphausen wrote: > Hi, > > On Tuesday, September 13, 2011 6:28:01 AM UTC+2, Ken Wesson wrote: >> >> They're trees of arrays of 32 items, and the trees can in principle >> have arbitrary depth. So the 2^31 limit on Java arrays doesn't impact >> the Clojure c

good ways to deal with compiler errors in SLIME (emacs)

2011-09-13 Thread Sergey Didenko
Hi, How can I see the error line number in SLIME? Or even somehow place editor point on the place of the error? For example when I load file in a lein repl, it prints: "java.lang.Exception: Unable to resolve symbol: dd in this context (mytest.clj:447)" However when I load this file in the SLIME

Re: puzzlement over lazy sequences

2011-09-13 Thread Stefan Kamphausen
Hi, On Tuesday, September 13, 2011 6:28:01 AM UTC+2, Ken Wesson wrote: > > > They're trees of arrays of 32 items, and the trees can in principle > have arbitrary depth. So the 2^31 limit on Java arrays doesn't impact > the Clojure collections, it seems. > are you sure? As far as I understood thi

Re: puzzlement over lazy sequences

2011-09-13 Thread Ken Wesson
On Tue, Sep 13, 2011 at 2:39 AM, Michael Gardner wrote: > On Sep 12, 2011, at 11:28 PM, Ken Wesson wrote: > >> But if, as you say, take, drop, etc. work for larger n, it should be >> easy to make nth work with larger n and non-random-access seqs, just >> by changing the non-random-access case to (