Re: How to compose futures?
2011/9/11 Kevin Downey > I hate to see agents used this way. If people want a thread pool they > should either use the ones provided by clojure, or create their own. > That's right, the "agents" part of my answer is more a hack. But the more interesting point I wanted to bring to the table for the brainstorming was the use of dataflow variables (via promise/deliver). I'd be happy to have your thoughts on this, provided that you're able to choose more delicate words/judgements than "smacks of ignorance", which, even if there's a possibility that as a non native english speaker I'm interpreting the wrong way, seem rude and hard to swallow. > Using agents when you want a thread pool smacks of ignorance. > > > http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html > > You can tell when you should be using a threadpool/futures instead > agents when you don't use an agent as an identity over a series of > values. > > On Sat, Sep 10, 2011 at 11:14 PM, Laurent PETIT > wrote: > > Hello, > > Would it make sense to use instead promise/deliver, and enque > computations > > in order in agents queues ? (worse parallelism, but more control over the > > number of threads ?) > > > > 2011/9/10 Illim > >> > >> I'm a clojure beginner and from the future api , the only way I found > >> to create a future from another is to block the resulting future's > >> thread with 'deref'. I'm a little bit afraid of exhausting my thread > >> pool. > >> For example: > >> (def x (future 1)) > >> (def y (future (+ 1 @x))) > >> y will block and consume a thread during x computation. > >> > >> -- > >> 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 group, send email to > >> clojure+unsubscr...@googlegroups.com > >> For more options, visit this group at > >> http://groups.google.com/group/clojure?hl=en > > > > -- > > 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 group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > > > -- > And what is good, Phaedrus, > And what is not good— > Need we ask anyone to tell us these things? > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to compose futures?
what you were suggesting, if I understand correctly, is re-implementing futures using agents instead of a thread pool. send an action off to an agent to be run, return a promise, the action delivers to the promise when the action completes. derefing the promise blocks until the action is run to completion. submit a Runnable/Callable to an executor, receive a Future. calls to get on the future block until the Runnable/Callable runs to completion. http://www.phrases.net/phrase/6934 "Using agents when you want a thread pool gives the impression of ignorance." On Sun, Sep 11, 2011 at 12:24 AM, Laurent PETIT wrote: > 2011/9/11 Kevin Downey >> >> I hate to see agents used this way. If people want a thread pool they >> should either use the ones provided by clojure, or create their own. > > That's right, the "agents" part of my answer is more a hack. > But the more interesting point I wanted to bring to the table for the > brainstorming was the use of dataflow variables (via promise/deliver). I'd > be happy to have your thoughts on this, provided that you're able to choose > more delicate words/judgements than "smacks of ignorance", which, even if > there's a possibility that as a non native english speaker I'm interpreting > the wrong way, seem rude and hard to swallow. > >> >> Using agents when you want a thread pool smacks of ignorance. >> >> >> http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html >> >> You can tell when you should be using a threadpool/futures instead >> agents when you don't use an agent as an identity over a series of >> values. >> >> On Sat, Sep 10, 2011 at 11:14 PM, Laurent PETIT >> wrote: >> > Hello, >> > Would it make sense to use instead promise/deliver, and enque >> > computations >> > in order in agents queues ? (worse parallelism, but more control over >> > the >> > number of threads ?) >> > >> > 2011/9/10 Illim >> >> >> >> I'm a clojure beginner and from the future api , the only way I found >> >> to create a future from another is to block the resulting future's >> >> thread with 'deref'. I'm a little bit afraid of exhausting my thread >> >> pool. >> >> For example: >> >> (def x (future 1)) >> >> (def y (future (+ 1 @x))) >> >> y will block and consume a thread during x computation. >> >> >> >> -- >> >> 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 group, send email to >> >> clojure+unsubscr...@googlegroups.com >> >> For more options, visit this group at >> >> http://groups.google.com/group/clojure?hl=en >> > >> > -- >> > 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 group, send email to >> > clojure+unsubscr...@googlegroups.com >> > For more options, visit this group at >> > http://groups.google.com/group/clojure?hl=en >> >> >> >> -- >> And what is good, Phaedrus, >> And what is not good— >> Need we ask anyone to tell us these things? >> >> -- >> 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 group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to compose futures?
Hi, now that I've stepped back a little bit and acknowledged my ignorance (while working on it : currently reading "Java concurrency in practice" :-) ), I can see why I've been so prompt to suggest that (while I can remember having said to others that using agents without caring about their state seems like an abuse) : futures and agents are part of core clojure. And unless I've overlooked clojure's core, one must go fall back to java interop if one wants its own thread pool. This remains me of the "viscosity" smell : if it's way easier to do the wrong thing than it is to do the right thing, expect people to do the wrong one. Thanks for pointing me to "smack of" definition. This way I've learned two things at once ;-) Cheers, -- Laurent 2011/9/11 Kevin Downey > what you were suggesting, if I understand correctly, is > re-implementing futures using agents instead of a thread pool. > > send an action off to an agent to be run, return a promise, the action > delivers to the promise when the action completes. derefing the > promise blocks until the action is run to completion. > > submit a Runnable/Callable to an executor, receive a Future. calls to > get on the future block until the Runnable/Callable runs to > completion. > > http://www.phrases.net/phrase/6934 > > "Using agents when you want a thread pool gives the impression of > ignorance." > > On Sun, Sep 11, 2011 at 12:24 AM, Laurent PETIT > wrote: > > 2011/9/11 Kevin Downey > >> > >> I hate to see agents used this way. If people want a thread pool they > >> should either use the ones provided by clojure, or create their own. > > > > That's right, the "agents" part of my answer is more a hack. > > But the more interesting point I wanted to bring to the table for the > > brainstorming was the use of dataflow variables (via promise/deliver). > I'd > > be happy to have your thoughts on this, provided that you're able to > choose > > more delicate words/judgements than "smacks of ignorance", which, even if > > there's a possibility that as a non native english speaker I'm > interpreting > > the wrong way, seem rude and hard to swallow. > > > >> > >> Using agents when you want a thread pool smacks of ignorance. > >> > >> > >> > http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html > >> > >> You can tell when you should be using a threadpool/futures instead > >> agents when you don't use an agent as an identity over a series of > >> values. > >> > >> On Sat, Sep 10, 2011 at 11:14 PM, Laurent PETIT < > laurent.pe...@gmail.com> > >> wrote: > >> > Hello, > >> > Would it make sense to use instead promise/deliver, and enque > >> > computations > >> > in order in agents queues ? (worse parallelism, but more control over > >> > the > >> > number of threads ?) > >> > > >> > 2011/9/10 Illim > >> >> > >> >> I'm a clojure beginner and from the future api , the only way I found > >> >> to create a future from another is to block the resulting future's > >> >> thread with 'deref'. I'm a little bit afraid of exhausting my thread > >> >> pool. > >> >> For example: > >> >> (def x (future 1)) > >> >> (def y (future (+ 1 @x))) > >> >> y will block and consume a thread during x computation. > >> >> > >> >> -- > >> >> 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 group, send email to > >> >> clojure+unsubscr...@googlegroups.com > >> >> For more options, visit this group at > >> >> http://groups.google.com/group/clojure?hl=en > >> > > >> > -- > >> > 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 group, send email to > >> > clojure+unsubscr...@googlegroups.com > >> > For more options, visit this group at > >> > http://groups.google.com/group/clojure?hl=en > >> > >> > >> > >> -- > >> And what is good, Phaedrus, > >> And what is not good— > >> Need we ask anyone to tell us these things? > >> > >> -- > >> 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 group, send email to > >> clojure+unsubscr...@googlegroups.com > >> For more options, visit this group at > >> http://groups.google.com/group/clojure?hl=en > > > > -- > > 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: Clojure in Emacs Seemingly Impossible
There should be an initiative to built own ide, look at Java history, it become popular when good ide with debugers, docs, highlighting and refactoring appeared. Clojure should have such ide, my vote right now is for clooj, since this is the only one ide written in supported language itself. Just combine your achivments like paraedit, syntax hihglighment, debbuger to put it in clooj. Look at #F also is a nice languge and it is still evloving but one think it is already ahead, it has good ide. On commercial grounds #F seems to be more mature. -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to compose futures?
Imho, using agents(or fixed size thread pool) in my case could be worst than using an unbounded thread pool. There's a risk to have all agents blocked waiting for each other. The library "die-geister" seems to perfectly fit my needs. Great! Still I would be grateful to hear a solution using only the clojure/ clojure-contrib api. On 11 sep, 10:29, Laurent PETIT wrote: > Hi, > > now that I've stepped back a little bit and acknowledged my ignorance (while > working on it : currently reading "Java concurrency in practice" :-) ), I > can see why I've been so prompt to suggest that (while I can remember having > said to others that using agents without caring about their state seems like > an abuse) : futures and agents are part of core clojure. And unless I've > overlooked clojure's core, one must go fall back to java interop if one > wants its own thread pool. > > This remains me of the "viscosity" smell : if it's way easier to do the > wrong thing than it is to do the right thing, expect people to do the wrong > one. > > Thanks for pointing me to "smack of" definition. This way I've learned two > things at once ;-) > > Cheers, > > -- > Laurent > > 2011/9/11 Kevin Downey > > > > > > > > > what you were suggesting, if I understand correctly, is > > re-implementing futures using agents instead of a thread pool. > > > send an action off to an agent to be run, return a promise, the action > > delivers to the promise when the action completes. derefing the > > promise blocks until the action is run to completion. > > > submit a Runnable/Callable to an executor, receive a Future. calls to > > get on the future block until the Runnable/Callable runs to > > completion. > > >http://www.phrases.net/phrase/6934 > > > "Using agents when you want a thread pool gives the impression of > > ignorance." > > > On Sun, Sep 11, 2011 at 12:24 AM, Laurent PETIT > > wrote: > > > 2011/9/11 Kevin Downey > > > >> I hate to see agents used this way. If people want a thread pool they > > >> should either use the ones provided by clojure, or create their own. > > > > That's right, the "agents" part of my answer is more a hack. > > > But the more interesting point I wanted to bring to the table for the > > > brainstorming was the use of dataflow variables (via promise/deliver). > > I'd > > > be happy to have your thoughts on this, provided that you're able to > > choose > > > more delicate words/judgements than "smacks of ignorance", which, even if > > > there's a possibility that as a non native english speaker I'm > > interpreting > > > the wrong way, seem rude and hard to swallow. > > > >> Using agents when you want a thread pool smacks of ignorance. > > >http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Thr... > > > >> You can tell when you should be using a threadpool/futures instead > > >> agents when you don't use an agent as an identity over a series of > > >> values. > > > >> On Sat, Sep 10, 2011 at 11:14 PM, Laurent PETIT < > > laurent.pe...@gmail.com> > > >> wrote: > > >> > Hello, > > >> > Would it make sense to use instead promise/deliver, and enque > > >> > computations > > >> > in order in agents queues ? (worse parallelism, but more control over > > >> > the > > >> > number of threads ?) > > > >> > 2011/9/10 Illim > > > >> >> I'm a clojure beginner and from the future api , the only way I found > > >> >> to create a future from another is to block the resulting future's > > >> >> thread with 'deref'. I'm a little bit afraid of exhausting my thread > > >> >> pool. > > >> >> For example: > > >> >> (def x (future 1)) > > >> >> (def y (future (+ 1 @x))) > > >> >> y will block and consume a thread during x computation. > > > >> >> -- > > >> >> 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 group, send email to > > >> >> clojure+unsubscr...@googlegroups.com > > >> >> For more options, visit this group at > > >> >>http://groups.google.com/group/clojure?hl=en > > > >> > -- > > >> > 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 group, send email to > > >> > clojure+unsubscr...@googlegroups.com > > >> > For more options, visit this group at > > >> >http://groups.google.com/group/clojure?hl=en > > > >> -- > > >> And what is good, Phaedrus, > > >> And what is not good— > > >> Need we ask anyone to tell us these things? > > > >> -- > > >> You received this message because you are subscribed to the Google > > >> Groups "Clojure" group. > > >> To post to this group, send emai
Re: Clojure in Emacs Seemingly Impossible
Hi Curran, I made this video for hacking Overtone with Emacs: http://vimeo.com/25190186 However, Overtone can just be viewed as an example project - it's really just a description of how to get a working Clojure/Emacs setup. Sam --- http://sam.aaron.name On 10 Sep 2011, at 18:29, Curran wrote: > Greetings, > > I would greatly appreciate any guidance on where to find a working and > complete set of instructions for how to set up Emacs with swank- > clojure. I am in Ubuntu. > > I have followed exactly every step of the instructions on this page > http://dev.clojure.org/display/doc/Getting+Started+with+Emacs, and > also (with a fresh install of Emacs) the version using Git in the > comment on that page by Martin Blais. With both methods, when I > execute "M-x clojure-jack-in", the message "Starting swank server" > appears and hangs. Swank never starts, the message never changes, and > I don't see any error messages anywhere (not sure where to look, maybe > I'm missing them?). > > I really would like to use Clojure for a significant project, but if I > can't get the dev environment working I'm hosed. > > Also, if I can't get Emacs going, would anyone suggest an alternative > development tool? (I know there are lots, but I don't know which to > try first). > > Thank you very much. > > Best regards, > Curran > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: What's wrong with my *print-dup* persistence?
Or (load-string "(+ 1 (+ 2 4))") Jonathan On Fri, Sep 9, 2011 at 5:14 PM, Chouser wrote: > On Thu, Sep 8, 2011 at 5:16 PM, Tassilo Horn > wrote: > > Hi all, > > > > I've just read Alan Malloy's excellent clojure persistence article at > > > > > http://amalloy.hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging > > > > Then I wanted to add a feature for persisting and reloading clojure data > > that also contains vertices and edges of some java graph datastructure. > > In contrast to his java.util.Date example, those cannot be simply > > created but have to be retrieved in the context of the graph that holds > > the vertex or edge in question. > > > > All vertices and all edges have a numeric and unique id in their graph, > > and a graph itself has a unique graph id (some string). A vertex can be > > retrieved by id using (vertex mygraph id), and it's likewise for edges > > (edge mygraph id). > > > > So my plan was to serialize vertices and edges as calls to those > > functions where the graph is looked up in a hash-map that has to be > > bound dynamically when reading the data back. That's what I came up > > with: > > > > --8<---cut here---start->8--- > > (def ^:dynamic > > *serialization-bindings* nil) > > > > (defmethod print-dup Vertex [v out] > > (.write out > > (str "#=" > > `(vertex (*serialization-bindings* ~(id (graph v))) ~(id > v) > > > > (defmethod print-dup Edge [e out] > > (.write out > > (str "#=" > > `(edge (*serialization-bindings* ~(id (graph e))) ~(id > e) > > > > (defn tg-pr [x] > > (binding [*print-dup* true] > >(pr-str x))) > > --8<---cut here---end--->8--- > > > > Testing that (rg is a memoized fn that returns just some sample graph), > > I get > > > > ==> (tg-pr [1 2 3 (vertex (rg) 1) 4]) > > "[1 2 3 #=(de.uni-koblenz.funtg.core/vertex > > (de.uni-koblenz.funtg.core/*serialization-bindings* > > \"c06de1c7-f4ec0906-21cfbc86-28c31aa1\") 1) > >4]" > > > > Looks good, I'd say. So my reloading function only needs to bind > > *serialization-bindings* to a map from graph id to graph, and it should > > work. > > > > --8<---cut here---start->8--- > > (defn tg-read [str & gs] > > (binding [*serialization-bindings* (into {} (map (fn [g] [(id g) g]) > > gs)) > >*print-dup* true] > >(binding [*print-dup* false];; For debugging... > > (println *serialization-bindings*)) > >(read-string str))) > > --8<---cut here---end--->8--- > > > > However, using that, I get an exception. > > > > de.uni-koblenz.funtg.test.core> (tg-read (tg-pr [1 2 3 (vertex (rg) 1) > 4]) (rg)) > > {c06de1c7-f4ec0906-21cfbc86-28c31aa1 # de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl@5203e0c6 > >} > > ; Evaluation aborted. > > No implementation of method: :vertex of protocol: > #'de.uni-koblenz.funtg.core/IDOps found for class: > clojure.lang.PersistentList > > I haven't tried all the above, but I had a couple thoughts that might help: > > First, inside #=(), arguments aren't evaluated. They act as if quoted: > >#=(+ 1 (+ 2 4)) >; ClassCastException clojure.lang.PersistentList cannot be cast to > java.lang.Number clojure.lang.Numbers.add (Numbers.java:126) > > The list (+ 2 4) is passed as a list to the outer +, which fails > because it's expecting a number not a list. So one alternative would > be: > >#=(+ 1 #=(+ 2 4)) >;=> 7 > > But please consider another alternative: > >(+ 1 (+ 2 4)) >;=> 7 > > That is, if you're going to be evaluating a large amount of code while > reading your data back into memory, why not just go ahead and eval it > instead of just reading it? > >(read-string "#=(+ 1 #=(+ 2 4))") > vs. >(eval (read-string "(+ 1 (+ 2 4))")) > > --Chouser > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: debugging
Sort of. http://georgejahad.com/clojure/cdt.html Jonathan On Sat, Sep 10, 2011 at 5:36 PM, Dennis Haupt wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > hi there, > > what's the currently best way to debug a clojure program? > ideally, i want to see all vars, symbols, functions etc. that are in > the current scope and be able evaluate expressions on the fly > > a "start repl here and stop program until repl is closed" would be > near perfect. does such a thing exist? > > > > - -- > > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.14 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJOa4QBAAoJENRtux+h35aG1Z4P/07rnp52lJFb6HqrKCNoPkFE > EZ4a1TxR1YYI8cBh6olcbdSxe/urFbT3JuQeR0v0/f1u/LjGzve00L+qbw3++f1v > +yC35BAomMh5aFDJk1v5hjP63hP+/BLt+eHA2MW+wgrHtHIArS1JuE9keJwhZsVT > W6F0AiVbbyedYieqVOhi7S8cn/0vrbVR9vaiDFytaW3ijihAMqt37pSRV8ptIGFo > bGJuGBt6uQFpuyM+6/3c4gUcf5wtLX7/515PVhxPqO5aLQrjHfk+fRj+++XQPxkX > WjCvd/Fl0Lkd0HbBX0TQyZwDKqYqJ7XXEfHIto7nMHwf9FVA0PWODfoYxkGlQnjX > wrXMouddA6S0MrdhtD4TwqBiYbWAINJP9uUCIMRtDYWkmmOEDK43VoZk9qk37H+W > ZKaCbrruaG0PYHlLxbPa5wapFb94KzgvZ2UFYN0XbKiFl4Tha2a86QS5ZI0jHpw2 > dmhBScFloWRbtZ3Rocwq8gBGyCJxE5u5qYHCELnC3a9e/LXPPyyO5d099QEUG4uM > H2u4FGbOSdn8Le+YWc0slcYueDQkZqdlFkrXFQ+vcNUzQZLZLNcVAgkZ62NhGnX8 > Vdq1F9zKxp91JjCrhq3VHyNYg0yte3Ygzx00U/tbepkCbhoLV+yp0KGEF5Mrxad7 > /4IpYf7B0AO7QvgRcQnU > =tERq > -END PGP SIGNATURE- > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Misleading Exception due to function name containing ->
I've had no problems with functions containing -> Jonathan On Fri, Sep 9, 2011 at 10:47 AM, Christina Conway wrote: > A function name contains the characters -> > e.g. foo->fn > The function causes an exception. > However the exception is not reported on the function but on another > function called before it. > java.lang.IllegalArgumentException: Wrong number of args (1) passed > to: datetime$other-fn > > If the > character is removed from the function name > e.g. foo-fn > then the same exception is thrown but on the function itself: > java.lang.IllegalArgumentException: Wrong number of args (1) passed > to: datetime$foo-fn > > If the - character is removed from the function name > e.g. foo>fn > then the exception is thrown on the function as follows: > java.lang.IllegalArgumentException: Wrong number of args (1) passed > to: datetime$foo-GT-fn > > The foo->fn function is compiled to a .class file as: > foo__GT_fn.class > The foo>fn function is compiled to a .class file as: > foo_GT_fn.class > The foo-fn function is compiled to a .class file as: > foo_fn.class > > Has anybody else encountered this with function names containing ->. > Is this a bug? > > Thanks, > cc > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: puzzlement over lazy sequences
Hi George, > Once again, I make a globally referenced, infinitely long stream. But > now I use "lazy-seq" > instead of "cycle": > >user=> (def ev-stream (lazy-seq (cons true (cons false ev- > stream >#'user/ev-stream >user=> (defn ev? [n] (nth ev-stream n)) >#'user/ev? >user=> (time (ev? 9876543210)) >"Elapsed time: 47244.061 msecs" >true > > OMG! Not only did it NOT hose the heap and crash, it actually ran much > faster than the version > with the unreferenced "(cycle [true false])". The consing version of ev-stream is self-referential, because you explicitly made it so by consing it back onto itself. So it only has two items in it, though it bounces back and forth between them forever. The cycling version is not self-referential. > The only reason I can think of, for this to NOT exhaust memory, is > that the lazy-seq macro knows > when to construct a circular list. Is that what happens? If so, why > DOESN'T it happen with "cycle", > where it's obviously the behavior one would want? cycle actually calls lazy-seq. A quick way to check such things at the REPL is with source: user=> (source cycle) (defn cycle "Returns a lazy (infinite!) sequence of repetitions of the items in coll." {:added "1.0" :static true} [coll] (lazy-seq (when-let [s (seq coll)] (concat s (cycle s) > Now I'll test it with 9876543210, a number which "ev?" was able to > handle: > >user=> (time (mod3 9876543210)) >"Elapsed time: 37759.615 msecs" >1 >user=> (mod 987654321 3) >0 > > Whoa! The computation finished in reasonable time, but with the WRONG > answer! How did that happen? > Did I find a bug? No, there is simply a typo in your input arg. Stu Stuart Halloway Clojure/core http://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 are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Misleading Exception due to function name containing ->
> The foo->fn function is compiled to a .class file as: > foo__GT_fn.class > The foo>fn function is compiled to a .class file as: > foo_GT_fn.class > The foo-fn function is compiled to a .class file as: > foo_fn.class > > Has anybody else encountered this with function names containing ->. > Is this a bug? This name munging is normal and is done because characters like >, -, * etc. are not allowed in Java class file names. Try using https://github.com/mmcgrana/clj-stacktrace for better stack-traces. That library will munge the names back into their original forms for better readability. Regards, BG -- Baishampayan Ghose b.ghose at gmail.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 are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
As an avid Emacs user - don't bother. If you just want a no hassle environment that supports Clojure development use Clooj. Steps - 1) Download 2) Double-click https://github.com/arthuredelstein/clooj David On Sat, Sep 10, 2011 at 1:29 PM, Curran wrote: > Greetings, > > I would greatly appreciate any guidance on where to find a working and > complete set of instructions for how to set up Emacs with swank- > clojure. I am in Ubuntu. > > I have followed exactly every step of the instructions on this page > http://dev.clojure.org/display/doc/Getting+Started+with+Emacs, and > also (with a fresh install of Emacs) the version using Git in the > comment on that page by Martin Blais. With both methods, when I > execute "M-x clojure-jack-in", the message "Starting swank server" > appears and hangs. Swank never starts, the message never changes, and > I don't see any error messages anywhere (not sure where to look, maybe > I'm missing them?). > > I really would like to use Clojure for a significant project, but if I > can't get the dev environment working I'm hosed. > > Also, if I can't get Emacs going, would anyone suggest an alternative > development tool? (I know there are lots, but I don't know which to > try first). > > Thank you very much. > > Best regards, > Curran > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
+1 -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
I don't know why an error message doesn't show, but the swank clojure readme explains a fallback method (lein swank + M-x slime-connect) that you could try. -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
I use Emacs for virtually everything, but have found that Emacs +Clojure is less than idea when working with multiple threads (like hosting and running a Jetty server). I believe this is mostly related to how Java and Emacs+Slime handles input/output redirection. I went crazy trying to figure out what output went where, and have settled with running Clojure outside of Emacs for the cases where I need to do server like / threading like things where I need to log to stdout/ stderr. In my case, outside Emacs means a simple "lein repl". YMMV. Thanks, Marius K. -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
On 11 Sep 2011, at 16:37, kjeldahl wrote: > I use Emacs for virtually everything, but have found that Emacs > +Clojure is less than idea when working with multiple threads (like > hosting and running a Jetty server). I believe this is mostly related > to how Java and Emacs+Slime handles input/output redirection. I went > crazy trying to figure out what output went where, and have settled > with running Clojure outside of Emacs for the cases where I need to do > server like / threading like things where I need to log to stdout/ > stderr. In my case, outside Emacs means a simple "lein repl". In Overtone we have threads coming out of our ears. However, I don't really have a problem with monitoring output. I use Emacs + cake, and all output for the current REPL process end up in the REPL within Emacs and the output for all other threads ends up in .cake/cake.log which I just simply tail in a separate (tiled) terminal. I'm pretty sure lein has a similarly sensible approach for dealing with output from the non-REPL threads. Sam --- http://sam.aaron.name -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
Yes, I had better success with cake (when I used it). But with the lein setup, I believe most of it goes into a swank buffer of some sort, which also contain a lot of other (non-related) output, and exactly where in that buffer it also ends up seems a bit undeterministic. But again, just my experiences, in case others experience similar issues. Thanks, Marius K. -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Exceptions in Haskell and in Clojure
Couldn't match expected type `(t, t1)' against inferred type `(t2, t3, t4)' In the expression: (8, 11, 5) In the expression: [(1, 2), (8, 11, 5), (4, 5)] In the definition of `it': it = [(1, 2), (8, 11, 5), (4, 5)] This was excerpt from Haskell exception, will Clojure have ever something like this? -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: An open call to the community: Let's prepare for 1.3
On Mon, Sep 5, 2011 at 1:26 PM, Stefan Kamphausen wrote: > could you please elaborate a bit on the swank-clojure issue? Alternatively > just point me to the threads that I should have read more closely. Now that Leiningen has user-level plugins, there's no need to put swank in project.clj since you don't want to force everyone who works on your project to download it. Just install it once for your own user. Basically :dev-dependencies should only contain things without which the tests or other build steps will not function. I'll try to make this more explicit in the documentation. -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to compose futures?
On Sun, Sep 11, 2011 at 1:29 AM, Laurent PETIT wrote: > now that I've stepped back a little bit and acknowledged my ignorance (while > working on it : currently reading "Java concurrency in practice" :-) ) Kevin pulled me up on this too (in IRC) and pointed me at the Java solution. As it happened I decided to avoid an async solution in the end (the speed up wasn't worth the complexity of adding concurrency in my situation - which I didn't know for sure until I'd tried both approaches). > This remains me of the "viscosity" smell : if it's way easier to do the > wrong thing than it is to do the right thing, expect people to do the wrong > one. Yes, it seems that this is a common enough need that it would be nice to have an idiomatic Clojure library to implement this, perhaps as part of new contrib? Kevin, I'd be particularly interested in your thoughts on that since I understand you feel the Java solution is already pretty clean and simple? -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
On Sun, Sep 11, 2011 at 9:09 AM, kjeldahl wrote: > with the lein setup, I believe most of it goes into a swank buffer of some > sort, which also contain a lot of other (non-related) output, and > exactly where in that buffer it also ends up seems a bit > undeterministic. I think it's consistent. It should always go to the stdout of the lein swank process if it's from a thread other than the one hooked into the slime repl. If you started it with M-x clojure-jack-in, that will be the *swank* buffer. It sounds like this isn't really what you want though. Would it be better if every time a new connection opened from Emacs it caused the root value of *out* to change? -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
Have you looked at the *swank* buffer? Maybe your's is looking differently than mine, but there's lots of stuff that I did not but there, and which I would not have there. My issues with this is related to running servers and catching debug output from it while it is running (yeah, I really should use a log file, but that's another topic). When I tried doing this from within Emacs, it became a detective hunt trying to figure it all out (and I probably never did). When I run it in a normal shell (lein repl), everything works as expected, and all threads output to the console they way I would expect. I wrote more details about it in the following post to this list: http://groups.google.com/group/clojure/browse_thread/thread/55849f0296530de8/9f2ca18530a4e28c?lnk=gst&q=kjeldahl#9f2ca18530a4e28c I'm no expert, but if I had to choose between getting all output in a file, or some output in the repl buffer and some in *swank*, I would prefer the former (which is what I believe cake actually does). Having said all this, I'm still thankful for your work, and my mention of this issue is just to try to help others who are just getting started. Thanks, Marius K. On Sep 11, 11:23 pm, Phil Hagelberg wrote: > On Sun, Sep 11, 2011 at 9:09 AM, kjeldahl > > wrote: > > with the lein setup, I believe most of it goes into a swank buffer of some > > sort, which also contain a lot of other (non-related) output, and > > exactly where in that buffer it also ends up seems a bit > > undeterministic. > > I think it's consistent. It should always go to the stdout of the lein > swank process if it's from a thread other than the one hooked into the > slime repl. If you started it with M-x clojure-jack-in, that will be > the *swank* buffer. > > It sounds like this isn't really what you want though. Would it be > better if every time a new connection opened from Emacs it caused the > root value of *out* to change? > > -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
On 11 Sep 2011, at 22:42, kjeldahl wrote: > > I'm no expert, but if I had to choose between getting all output in a > file, or some output in the repl buffer and some in *swank*, I would > prefer the former (which is what I believe cake actually does). Used from within Emacs, cake places all output from the REPL thread into the Slime REPL buffer and output from all other threads into .cake/cake.log So perhaps this isn't exactly what you want… Sam --- http://sam.aaron.name -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
On Sun, Sep 11, 2011 at 2:42 PM, kjeldahl wrote: > Have you looked at the *swank* buffer? Maybe your's is looking > differently than mine, but there's lots of stuff that I did not but > there, and which I would not have there. Everything in there is output from lein jack-in. Much of it is elisp, since Leiningen spits out the elisp that's needed to bootstrap a connection. But it is consistent. (In 1.3.3 it will need a lot less elisp.) On top of the root value of *out* (which is always stdout of lein), each swank thread necessarily must bind *out* to a writer connected to the slime socket, otherwise the repl wouldn't get hooked up. > My issues with this is related to running servers and catching debug > output from it while it is running (yeah, I really should use a log > file, but that's another topic). When I tried doing this from within > Emacs, it became a detective hunt trying to figure it all out (and I > probably never did). When I run it in a normal shell (lein repl), > everything works as expected, and all threads output to the console > they way I would expect. > > I wrote more details about it in the following post to this list: > > http://groups.google.com/group/clojure/browse_thread/thread/55849f0296530de8/9f2ca18530a4e28c?lnk=gst&q=kjeldahl#9f2ca18530a4e28c > > I'm no expert, but if I had to choose between getting all output in a > file, or some output in the repl buffer and some in *swank*, I would > prefer the former (which is what I believe cake actually does). Putting *all* output in a file (so nothing is visible in the repl) is never going to be the default behaviour. The question is whether swank should use alter-var-root instead of binding to change the value of *out*. I don't personally work with any multithreaded programs that don't use a logging framework, so I haven't run into this myself, but it seems like as long as you're not relying on the stdout of the process it might be better to use the alter-var-root approach, at least when swank is launched via lein. Does that sound helpful? -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: puzzlement over lazy sequences
On Sun, Sep 11, 2011 at 8:28 AM, Stuart Halloway wrote: > cycle actually calls lazy-seq. A quick way to check such things at the REPL > is with source: > user=> (source cycle) > (defn cycle > "Returns a lazy (infinite!) sequence of repetitions of the items in coll." > {:added "1.0" > :static true} > [coll] (lazy-seq > (when-let [s (seq coll)] > (concat s (cycle s) > Is there any reason not to define it as (defn cycle "Returns a lazy (infinite!) sequence of repetitions of the items in coll." {:added "1.0" :static true} [coll] (let [l (lazy-seq (when-let [s (seq coll)] (concat s l This will have the effect that holding any element of the cycle holds the head; however, even the original holds the head of s as long as the cycle is referenced, so that at worst doubles memory use for finite s, and for finite walks along the cycle with infinite s, as s (or the first N elements of s) get held onto in both cases, but an equal number of cycle elements get held onto with the self-referencing cycle instead of potentially only one at a time. > Now I'll test it with 9876543210, a number which "ev?" was able to > handle: > > user=> (time (mod3 9876543210)) > "Elapsed time: 37759.615 msecs" > 1 > user=> (mod 987654321 3) > 0 > > Whoa! The computation finished in reasonable time, but with the WRONG > answer! How did that happen? > Did I find a bug? > > No, there is simply a typo in your input arg. True, but both numbers are congruent to 0 mod 3, so where did the 1 come from in (time (mod3 9876543210))? -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
On Sat, Sep 10, 2011 at 10:29, Curran wrote: > I would greatly appreciate any guidance on where to find a working and > complete set of instructions for how to set up Emacs with swank- > clojure. I am in Ubuntu. > > I have followed exactly every step of the instructions on this page > http://dev.clojure.org/display/doc/Getting+Started+with+Emacs, and > also (with a fresh install of Emacs) the version using Git in the > comment on that page by Martin Blais. With both methods, when I > execute "M-x clojure-jack-in", the message "Starting swank server" > appears and hangs. Swank never starts, the message never changes, and > I don't see any error messages anywhere (not sure where to look, maybe > I'm missing them?). I do believe that is the same error I recently hit. To use `clojure-jack-in` you need a quite recent version of the `lein-swank` plugin. You *also* need to make sure that nothing else on the load path has an older version. That means anything in your current project, *and* any either leinengein plugins. (I got bitten be the later.) You need to see ";;; proceed to jack in" output from `lein jack-in 1234` for that all to work together. This was tricky to diagnose, and the bundled version in the other plugin stumped me for quite some time. Daniel -- ♲ Made with 100 percent post-consumer electrons -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
Hi Curran, I'm in the process of learning Clojure and emacs as well and have run into a bit of difficulty as well, though I have a slightly different problem. I grabbed the 23.3 version of emacs from their ftp site and did NOT use the emacs starter kit. I discovered that the version of package.el that came with the emacs starter kit (at least the non git pulled one) was not playing nice with a few things. So instead, I just copied the package.el from the marmalade website and followed the instructions there (http://marmalade-repo.org). Once package.el and marmalade were set up (package.el in my ~/.emacs.d folder, and the appropriate load code in my ~/.emacs file), I was ready to load clojure-mode. Just do: M-x package-refresh-contents M-x package-install And when prompted, type in clojure-mode and hit enter. That should install clojure-mode for you. And then finally, if you want to use clojure-jack-in, make sure you have both leiningen and the swank- clojure plugin installed. Leiningen was pretty easy to install, just go to https://github.com/technomancy/leiningen and follow the instructions. Once leiningen is installed and set in your $PATH, then you can install the swank-clojure plugin. lein plugin install swank-clojure "1.3.2" Now that you have leiningen, you can create a simple project with 'lein new my_clj_project', and it will generate a skeleton project for you. Since leiningen uses some Maven under the covers, it uses the maven-style convention of putting your source code under the src folder, and your namespaces are named starting from that path directory. Once you have a simple clojure file, you can try out the swank server. In emacs, you "visit" a file: C-x C-f And in the minibuffer, you can type the path to your file (it has some nifty code completion). Or if you prefer, you can hit C-F10 to open the menu bar (if it's not there already), and just click Open and browse to your file. Once the file is open in a buffer in emacs, now you can try to connect to swank. M-x clojure-jack-in If all goes well, you should see the swank server start up on port 4005 and you will have a REPL to play in. There should be a buffer called *swank* with messages from the swank server if it connected or not. My problem however is that I can't seem to load my namespace(s) into the swank REPL. I tried C-c C-l, but that only seemed to load some definitions from my namespace (it didn't load any of my (defrecords ...) I noticed). I tried in the REPL to do a (use 'my_project.myfile), but that still didn't appear to load anything from my namespace. Not being able to load namespaces from my leiningen project makes the swank REPL nearly useless to me. I can easily start a REPL through the command line with just the clojure jar or with the clojure plugin for jEdit. I suppose I could highlight all my code and eval it, but that seems silly. But anyway, hope that helps some. And, now a shameless plugfeel free to drop by my little blog site http://underaboddhitree.blogspot.com. It's a little of everything, but mostly geared towards python and my learning experience with clojure. I think that most blogs you see come from the Clojure masters...but sometimes I think they may have lost sight of a new clojurian's experience. I have no lisp background, except a 3 week crash course on lisp in my AI class in college several years ago. I also have zero experience with emacs except the last 2 weeks or so. Nor am I a functional master in any regard, and Clojure is the first functional language I have started to learn. But for me, the reward is worth the challenge. On Sep 10, 11:29 am, Curran wrote: > Greetings, > > I would greatly appreciate any guidance on where to find a working and > complete set of instructions for how to set up Emacs with swank- > clojure. I am in Ubuntu. > > I have followed exactly every step of the instructions on this > pagehttp://dev.clojure.org/display/doc/Getting+Started+with+Emacs, and > also (with a fresh install of Emacs) the version using Git in the > comment on that page by Martin Blais. With both methods, when I > execute "M-x clojure-jack-in", the message "Starting swank server" > appears and hangs. Swank never starts, the message never changes, and > I don't see any error messages anywhere (not sure where to look, maybe > I'm missing them?). > > I really would like to use Clojure for a significant project, but if I > can't get the dev environment working I'm hosed. > > Also, if I can't get Emacs going, would anyone suggest an alternative > development tool? (I know there are lots, but I don't know which to > try first). > > Thank you very much. > > Best regards, > Curran -- 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 group, send email to c
Functional Programming eXchange 2012: Call for abstracts
Hello all, I’m sending this email to several mailing lists so my apologies if you see this twice. Functional Programming eXchange is a developer conference that focuses on functional programming. The 2012 edition will take place on Friday March 16th March 2012, at the Skills Matter eXchange, in London. Typically talks are explore concepts that often crop up in functional programming such as parallelism or domain specific languages, look at frameworks built in functional languages or are cases studies of using functional programming in industry. Previous speakers have included: Simon Peyton Jones, Miles Sabin, David Pollak, Adam Granicz, Antonio Cisternino, Tomas Petricek, Jonas Boner, and Viktor Klang. Videos of the talks at the previous events can be found here: http://skillsmatter.com/event/scala/functionalpx-2011 http://skillsmatter.com/event/cloud-grid/functional-programming-exchange-2009 If you are interested at speaking at this conference please send a talk abstract to talks_functiona...@skillsmatter.com. I’m aiming to make the decision about which talks have been chosen around 14th October so if you submit an abstract expect to hear from me around this time. Kind regards, Robert -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: An open call to the community: Let's prepare for 1.3
Cake's global project allows for dev deps to be set for all projects, so this applies to cake as well. -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: puzzlement over lazy sequences
Hi, Stu, Loving your book! I posted a reply earlier, through a different interface, which went to "moderators". Sorry for the clumsiness, but I'm not familiar with the mechanics of newsgroups. On Sep 11, 7:28 am, Stuart Halloway wrote: > The consing version of ev-stream is self-referential, because you explicitly > made it so by consing it back onto itself. So it only has two items in it, > though it bounces back and forth between them forever. The cycling version is > not self-referential. Since it's the self reference that gives the nice results (finite memory consumption, and apparently better speed), I came up with a little macro to provide it: (defmacro defcycle [name coll] `(def ~name (lazy-seq (concat ~coll ~name))) ) This is probably not the most useful way to do it, since the user has to provide name. > > Now I'll test it with 9876543210, a number which "ev?" was able to > > handle: > > > user=> (time (mod3 9876543210)) > > "Elapsed time: 37759.615 msecs" > > 1 > > user=> (mod 987654321 3) > > 0 > > > Whoa! The computation finished in reasonable time, but with the WRONG > > answer! How did that happen? > > Did I find a bug? > > No, there is simply a typo in your input arg. with the typo fixed, i.e. (mod 9876543210 3), the result is still 0. regards, George -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
Greetings, Wow, thank you all so much for the insightful responses to my inquiry! I really appreciate the supportive community. I developed a small web app in Clooj over the weekend and was very impressed by it! A very cool idea to write the IDE for the language, in the language, with the essential powerful and useful features and no cruft at all. Nice tool! @Michael Jaaka I like your attitude toward this - that when there is an effective IDE tailored to the language, then the language will flourish, and that Clooj in the future could play the same role for Clojure as Eclipse and Netbeans did for Java (in making it accessible and usable for a generation of programmers). I haven't touched Clojure for about a year and I am so impressed with all that has happened in it's development since then. It is a technology with a bright future for sure! I will keep battling with the Emacs setup, thanks again for the support. Best, Curran On Sep 11, 5:13 am, Sean Toner wrote: > Hi Curran, > > I'm in the process of learning Clojure and emacs as well and have run > into a bit of difficulty as well, though I have a slightly different > problem. I grabbed the 23.3 version of emacs from their ftp site and > did NOT use the emacs starter kit. I discovered that the version of > package.el that came with the emacs starter kit (at least the non git > pulled one) was not playing nice with a few things. So instead, I > just copied the package.el from the marmalade website and followed the > instructions there (http://marmalade-repo.org). > > Once package.el and marmalade were set up (package.el in my ~/.emacs.d > folder, and the appropriate load code in my ~/.emacs file), I was > ready to load clojure-mode. Just do: > > M-x package-refresh-contents > M-x package-install > > And when prompted, type in clojure-mode and hit enter. That should > install clojure-mode for you. And then finally, if you want to use > clojure-jack-in, make sure you have both leiningen and the swank- > clojure plugin installed. Leiningen was pretty easy to install, just > go tohttps://github.com/technomancy/leiningen and follow the > instructions. Once leiningen is installed and set in your $PATH, then > you can install the swank-clojure plugin. > > lein plugin install swank-clojure "1.3.2" > > Now that you have leiningen, you can create a simple project with > 'lein new my_clj_project', and it will generate a skeleton project for > you. Since leiningen uses some Maven under the covers, it uses the > maven-style convention of putting your source code under the src > folder, and your namespaces are named starting from that path > directory. > > Once you have a simple clojure file, you can try out the swank > server. In emacs, you "visit" a file: > > C-x C-f > > And in the minibuffer, you can type the path to your file (it has some > nifty code completion). Or if you prefer, you can hit C-F10 to open > the menu bar (if it's not there already), and just click Open and > browse to your file. Once the file is open in a buffer in emacs, now > you can try to connect to swank. > > M-x clojure-jack-in > > If all goes well, you should see the swank server start up on port > 4005 and you will have a REPL to play in. There should be a buffer > called *swank* with messages from the swank server if it connected or > not. > > My problem however is that I can't seem to load my namespace(s) into > the swank REPL. I tried C-c C-l, but that only seemed to load some > definitions from my namespace (it didn't load any of my > (defrecords ...) I noticed). I tried in the REPL to do a (use > 'my_project.myfile), but that still didn't appear to load anything > from my namespace. Not being able to load namespaces from my > leiningen project makes the swank REPL nearly useless to me. I can > easily start a REPL through the command line with just the clojure jar > or with the clojure plugin for jEdit. I suppose I could highlight all > my code and eval it, but that seems silly. > > But anyway, hope that helps some. And, now a shameless plugfeel > free to drop by my little blog sitehttp://underaboddhitree.blogspot.com. > It's a little of everything, but mostly geared towards python and my > learning experience with clojure. I think that most blogs you see > come from the Clojure masters...but sometimes I think they may have > lost sight of a new clojurian's experience. I have no lisp > background, except a 3 week crash course on lisp in my AI class in > college several years ago. I also have zero experience with emacs > except the last 2 weeks or so. Nor am I a functional master in any > regard, and Clojure is the first functional language I have started to > learn. > > But for me, the reward is worth the challenge. > > On Sep 10, 11:29 am, Curran wrote: > > > > > > > > > Greetings, > > > I would greatly appreciate any guidance on where to find a working and > > complete set of instructions for how to set up Emacs with swank- > > clojure. I am in Ubun
Re: How to compose futures?
Clojure's concurrency primitives are built on the functionality provided by java.util.concurrent and I think solutions for asynchronous composition should also be built on java.util.concurrent. Agents are identities over a series of results from asynchronous function application. Nothing about composable async tasks there. I don't think java has a nice solution we can just use, but all the bits we need are there. die-geister is sort of a rough sketch of what could be built, it needs better control over which thread pool tasks are schedule on, and most of the custom types it uses should just be Futures. http://channel9.msdn.com/events/PDC/PDC10/FT09 http://medianetwork.oracle.com/media/show/17013 (this is my favorite video, because it is the only one I've seen that talks at least a little about how the new Task<>s are scheduled) http://tomasp.net/academic/joinads/joinads.pdf On Sun, Sep 11, 2011 at 2:22 PM, Sean Corfield wrote: > On Sun, Sep 11, 2011 at 1:29 AM, Laurent PETIT > wrote: >> now that I've stepped back a little bit and acknowledged my ignorance (while >> working on it : currently reading "Java concurrency in practice" :-) ) > > Kevin pulled me up on this too (in IRC) and pointed me at the Java > solution. As it happened I decided to avoid an async solution in the > end (the speed up wasn't worth the complexity of adding concurrency > in my situation - which I didn't know for sure until I'd tried both > approaches). > >> This remains me of the "viscosity" smell : if it's way easier to do the >> wrong thing than it is to do the right thing, expect people to do the wrong >> one. > > Yes, it seems that this is a common enough need that it would be nice > to have an idiomatic Clojure library to implement this, perhaps as > part of new contrib? > > Kevin, I'd be particularly interested in your thoughts on that since I > understand you feel the Java solution is already pretty clean and > simple? > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > Railo Technologies, Inc. -- http://www.getrailo.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > > -- > 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 group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
clojure tutorial for haskell programers?
Hi, when i first came to clojure world i've started with tutorial for java programers, now i'm reading about haskell and for almost every new feature I know that my favorite language clojure already has that, but i'm not fully sure which feature it is. For example comprehensions are implemented by "for", but what about classtype or pattern matching? Do you know any tutorial, video or article which summarizes that? -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: puzzlement over lazy sequences
I believe the bug can be blamed on "nth". Using "nth", I make a function which should be identity on natural numbers: Clojure 1.2.1 user=> (defn ident [n] (nth (iterate inc 0) n)) #'user/ident And it works, for reasonable size numbers: user=> (ident 12345) 12345 user=> (ident 7654321) 7654321 But, with a ridiculously huge number... user=> (ident 9876543210) 1286608618 ...something goes wrong. Also, when I replace "nth" in my code (in the top post) with "mth", then it works. Here's "mth": user=> (defn mth [seq m] (if (zero? m) (first seq) (recur (rest seq) (dec m #'user/mth user=> (mth (iterate inc 0) 123456) 123456 user=> (mth (iterate inc 0) 9876543210) 9876543210 Of course, "mth" is godawful slow. I guess nobody wanted to find the 9876543210th element of a sequence, until this wanking dilettante came along! cheers, George -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: puzzlement over lazy sequences
Integer overflow. user> (mod 9876543210 (bigint (Math/pow 2 32))) 1286608618 On Sep 11, 9:44 pm, George Kangas wrote: > I believe the bug can be blamed on "nth". > > Using "nth", I make a function which should be identity on natural > numbers: > > Clojure 1.2.1 > user=> (defn ident [n] (nth (iterate inc 0) n)) > #'user/ident > > And it works, for reasonable size numbers: > > user=> (ident 12345) > 12345 > user=> (ident 7654321) > 7654321 > > But, with a ridiculously huge number... > > user=> (ident 9876543210) > 1286608618 > > ...something goes wrong. > > Also, when I replace "nth" in my code (in the top post) with "mth", > then it works. Here's "mth": > > user=> (defn mth [seq m] (if (zero? m) (first seq) (recur (rest seq) > (dec m > #'user/mth > user=> (mth (iterate inc 0) 123456) > 123456 > user=> (mth (iterate inc 0) 9876543210) > 9876543210 > > Of course, "mth" is godawful slow. > > I guess nobody wanted to find the 9876543210th element of a sequence, > until this wanking dilettante came along! > > cheers, > George -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure sort: is it specified to be stable for all targets?
G'day. The API documentation for clojure doesn't specify if the sort method is stable, unstable, or "implementation defined". Java defines sort to be stable, but Clojure also has two other targets, and I can't tell if I am safe making the assumption that the stable behaviour will carry over to them, or if they will just have whatever the implementor decided. Daniel -- ♲ Made with 100 percent post-consumer electrons -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
> > Also, if I can't get Emacs going, would anyone suggest an alternative > development tool? (I know there are lots, but I don't know which to > try first). > > I use IntelliJ IDEA with La Clojure and Leiningen plugin. I usually create a skeleton project with leiningen on the command line, then create an empty project from scratch in IntelliJ IDE and you're ready to go. It is really neat and IntelliJ has also Emacs keybinding if you want. - Finn -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure in Emacs Seemingly Impossible
My recollection of how cake did it was probably wrong. As for how I would like to have it, I would like to have all output from all threads appear in the emacs repl buffer, similar to how it behaves in "console" mode, and that is what I haven't figured out how to do or found any workaround for, except not running it from an emacs repl. Assuming that is not easy, or even possible, right now, I'll stick with a simple repl console for the server/threaded stuff. Thanks, Marius K. On Sep 12, 12:06 am, Phil Hagelberg wrote: > Putting *all* output in a file (so nothing is visible in the repl) is > never going to be the default behaviour. The question is whether swank > should use alter-var-root instead of binding to change the value of > *out*. I don't personally work with any multithreaded programs that > don't use a logging framework, so I haven't run into this myself, but > it seems like as long as you're not relying on the stdout of the > process it might be better to use the alter-var-root approach, at > least when swank is launched via lein. Does that sound helpful? > > -Phil -- 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 group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en