Re: How to go about finding a Clojure job
Another possibility is to work at research position where you can select technologies by yourself :) -- 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
One little question about vectors and nth?
I have an object called cone. I can change the origin of the cone with this: (.SetOrigin cone 1 1 1) I have a vector called v (def v [2 4 6 8]) And I would like to take 3 elements of the vector v and to set to the origin of the cone. But when I write this I obtain an error: (.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3))) ;=> # What I am doing wrong? -- 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: [ANN] clojure.java.jdbc 0.2.3 available on Maven Central
> > Our web stack is built on small libraries building on eachother's > strengths, could we do the same here ? > Yeah, that's exactly what I had in mind. Just like Ring, c.j.jdbc could accept maps and generate corresponding sql code, thus eliminating the need to write a compiler for each sql DSL. -- 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: One little question about vectors and nth?
you don't need the list (and it's wrong doing so). Try (.SetOrigin cone (nth v 0) (nth v 1) (nth v 2)) or (.SetOrigin cone (v 0) (v 1) (v 2)) -thomas On 23.06.2012 11:33, Antonio Recio wrote: I have an object called cone. I can change the origin of the cone with this: (.SetOrigin cone 1 1 1) I have a vector called v (def v [2 4 6 8]) And I would like to take 3 elements of the vector v and to set to the origin of the cone. But when I write this I obtain an error: (.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3))) ;=> #clojure.lang.PersistentList to [D> What I am doing wrong? -- 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: One little question about vectors and nth?
You're passing one argument, a list contaning 3 elements, instead of 3 arguments. Try this (by the way, you can omit nth call): (.SetOrigin cone (v 0) (v 2) (v 3)) Another option (not really relevant in this particular case) is to use memfn: (apply (memfn SetOrigin) cone [2 4 6]) суббота, 23 июня 2012 г., 15:33:23 UTC+6 пользователь Antonio Recio написал: > > I have an object called cone. I can change the origin of the cone with > this: > (.SetOrigin cone 1 1 1) > > I have a vector called v > (def v [2 4 6 8]) > > And I would like to take 3 elements of the vector v and to set to the > origin of the cone. But when I write this I obtain an error: > (.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3))) > ;=> # clojure.lang.PersistentList to [D> > > What I am doing wrong? > > -- 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: One little question about vectors and nth?
Or use destructuring: (let [[x y z] [1 2 3 4]] (.setOrigin x y z)) I myself would always prefer this method as it describes gives the elements in the vector a structure. See [1] for a blog post about this. [1]: http://tech.puredanger.com/2011/10/12/2-is-a-smell/ On Sat, Jun 23, 2012 at 12:09 PM, Vinzent wrote: > You're passing one argument, a list contaning 3 elements, instead of 3 > arguments. Try this (by the way, you can omit nth call): > > (.SetOrigin cone (v 0) (v 2) (v 3)) > > Another option (not really relevant in this particular case) is to use > memfn: > > (apply (memfn SetOrigin) cone [2 4 6]) > > суббота, 23 июня 2012 г., 15:33:23 UTC+6 пользователь Antonio Recio написал: >> >> I have an object called cone. I can change the origin of the cone with >> this: >> (.SetOrigin cone 1 1 1) >> >> I have a vector called v >> (def v [2 4 6 8]) >> >> And I would like to take 3 elements of the vector v and to set to the >> origin of the cone. But when I write this I obtain an error: >> (.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3))) >> ;=> #> clojure.lang.PersistentList to [D> >> >> What I am doing wrong? >> > -- > 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 -- Moritz Ulrich -- 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: error in clojurescript compilation
Can you show us some relevant lines in core.clj? This error means usually mistakes like a forgotten binding vector somewhere. On Sat, Jun 23, 2012 at 4:49 AM, Murtaza Husain wrote: > Hi, > > I was hacking away happily with my clojurescript, when suddenly this error > seems to crop up - > > java.lang.IllegalArgumentException: Parameter declaration clojure.core/let > should be a vector > core.clj:6567 clojure.core/assert-valid-fdecl > core.clj:220 clojure.core/sigs > > I have tried commenting all bits of code, restarted the server etc . I > am using cljsbuild 0.2.1 for comiplation. > > Thanks, > Murtaza > > -- > 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 -- Moritz Ulrich -- 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: A tutorial for how to setup your clojure development environment for: Emacs, Leiningen and Linux.
Because emacs is traditionally THE editor for lispy programming languages and is so versatile. Of course there are other IDEs out there and you should try a few, but Emacs is easily the most common tool when programming lisp and therefore has the biggest variety of helpers available. -- Sent from my mobile Am 23.06.2012 07:52 schrieb "Qiu Xiafei" : > p.s. I think idea + la enclosure works quite wellwhy beginners are > always introduced to emacs solution? > > On Sat, Jun 23, 2012 at 4:45 AM, fenton wrote: > >> Hi Brad, I've updated my doc with your questions. Here is how I >> responded to your particular queries. Note the answer may not be correct >> as I'm a clojure newbie myself. >> >> - >> >> Leiningen is a build tool like maven for java, or rake (i think) for >> ruby. You can use it to publish your jar into maven repositories for >> example. >> >> Slime is a protocol that lets you communicate from emacs to a >> listening server. In clojure, we start a swank server, which is the >> clojure REPL process, and connect to it from emacs, speaking 'slime'. >> The net effect is that we can have a REPL inside our emacs editor. >> >> - >> >> >> On Thursday, June 21, 2012 5:58:23 PM UTC-7, brad bowman wrote: >>> >>> On Thursday, June 21, 2012 12:58:19 PM UTC+10, John Gabriele wrote: On Jun 18, 10:23 pm, Chris Zheng wrote: > {snip} > So basically, if a 'lead clojure evangelist' can either 'officially' or > 'unofficially' recommend ONE emacs setup, along with a bunch of > videos/tutorials that demonstrate how to code and how fast it is to design > and code using the repl. Then that be enough to get people at least > interested. People are very opinionated about their editor/IDE. I think the Getting +Started docs are good --- they separate: * if you want just Emacs plus the repl, here you go (clojure-mode readme) * if you want Emacs + inferior-lisp, do this (this doc needs work) * if you want Emacs + swank/slime, do this (swank-clojure readme) and of course also info on Eclipse, Clooj, and other editors/ide's as well. >>> >>> I'm right at the start of this process, completely unfamiliar with >>> Clojure, >>> Leiningen, Emacs, Java and all of the projects with cute names. >>> I don't even know what I want. >>> >>> I've cut and pasted various git-clone and lein commands, but have no idea >>> about the bigger picture. I'm happy to dawdle along on my own, but if my >>> current (and hopefully temporary) ignorance can provide feedback on a >>> start-up guide then let me know. >>> >>> At present I'm often wondering "what is this thing? why do I want it?". >>> Slime for example. I don't especially want answers here, but something >>> like >>> a glossary for the clojure ecosystem would be handy (not that I've >>> looked hard). >>> >>> Another document that might useful is a platform Rosetta stone >>> matching clojure tools and libraries to those that fill a similar role >>> in other >>> languages (Java and Ruby for starters). This is more of a "nice to >>> have". >>> >>> Thanks, >>> >>> Brad >>> >> -- >> 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 -- 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
Little question about doto?
I create a white sphere at the beginning of my code, and later, after some lines of code, I change the color and the position of this sphere. (def sphere (doto (mesh.sphere.) (.SetColor white)) (...) (...) (...) (.. sphere SetColor red) (.. sphere SetPosition 5 5 0)) To change the color and the position I need to repeat "sphere" each time. Is there any way to avoid repeat "sphere" each time, for example using "doto"? (def sphere (doto (mesh.sphere.) (.SetColor white)) (...) (...) (...) (doto sphere (.SetColor red) (.SetPosition 5 5 0)) -- 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: Little question about doto?
I am not sure what exactly you're asking since you are already using 'doto' in your example so you already know what it does...Personally I would do something like this: (defn make-sphere [&{:keys [color position] :or {color 'white position 0 0 0}}] (let [sphere (mesh.sphere.)] (doto sphere (.SetColor color) (.SetPosition position) (...) (...) (...) ))) Jim ps: 'doto' will give you back the object and will not ask you to repeat the name in every expression following (as opposed to 'do' where you have to return it explicitely via the last expression). On 23/06/12 14:21, Antonio Recio wrote: I create a white sphere at the beginning of my code, and later, after some lines of code, I change the color and the position of this sphere. (def sphere (doto (mesh.sphere.) (.SetColor white)) (...) (...) (...) (.. sphere SetColor red) (.. sphere SetPosition 5 5 0)) To change the color and the position I need to repeat "sphere" each time. Is there any way to avoid repeat "sphere" each time, for example using "doto"? (def sphere (doto (mesh.sphere.) (.SetColor white)) (...) (...) (...) (doto sphere (.SetColor red) (.SetPosition 5 5 0)) -- 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: Little question about doto?
Well, yes, you've written it right: (doto sphere (.SetColor red) (.SetPosition 5 5 0)) ... or what the question was about? суббота, 23 июня 2012 г., 19:21:18 UTC+6 пользователь Antonio Recio написал: > > I create a white sphere at the beginning of my code, and later, after some > lines of code, I change the color and the position of this sphere. > > (def sphere (doto (mesh.sphere.) > (.SetColor white)) > > (...) > (...) > (...) > > (.. sphere SetColor red) > (.. sphere SetPosition 5 5 0)) > > > To change the color and the position I need to repeat "sphere" each time. > Is there any way to avoid repeat "sphere" each time, for example using > "doto"? > > (def sphere (doto (mesh.sphere.) > (.SetColor white)) > > (...) > (...) > (...) > > (doto sphere > (.SetColor red) > (.SetPosition 5 5 0)) > -- 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
Difference between defrecord and extend
Hi, I have discovered strange difference between methods implemented directly in defrecord and methods added later using extend (extend-type). I simplified the issue to code example listed bellow. Both records FooRec and BarRec implement simple protocol FooProto with method foo. There is also evil function transmogrify, which takes a function F and returns new function which calls F. I use transmogrify to produce function foo* If you call foo method directly, everything works as expected. When you call foo*, FooRec method is OK, but BarRec fails with following exception No implementation of method: :foo of protocol: #'user/FooProto found for class: user.BarRec Which looks weird because you can call foo directly... I expect that defrecord and extend use different approach to extending the type and foo* ends up with a reference to old version of protocol. `defrecord` somehow manages to modify directly the protocol definition referenced by foo*, while `extend` takes more immutable approach and replaces old protocol definition (which foo* cannot see). I briefly dived into Clojure sources and found that indeed `extend` ends with some sort of alter-root-var, while `defrecord` traces ends deep in java sources (deftype*). It would be good idea to unify defrecord and extend so they have same behaviour. Dan (defprotocol FooProto (foo [X Y] "Make a foo")) (defn transmogrify [F Y] (fn [A] (F A Y))) (def foo* (transmogrify foo "Bar")) (defrecord FooRec [] FooProto (foo [X Y] (println "Hello," Y))) (foo (FooRec.) "World") ; -> Hello, World (foo* (FooRec.)) ; -> Hello, Bar (defrecord BarRec []) (extend-type BarRec FooProto (foo [X Y] (println "Bar" Y))) (foo (BarRec.) "Bar") ; -> Bar Bar (foo* (BarRec.)) ; bang! ; No implementation of method: :foo of protocol: #'user/FooProto found for class: user.BarRec -- 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
ANN: clj-sitemap has been released!
clj-sitemap is a sitemap.xml and robots.txt generator for clojure web apps. This is my first time releasing a clojure library, so any comments and suggestions would be greatly appreciated. https://clojars.org/clj-sitemap https://github.com/levicc00123/clj-sitemap -- 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: ClojureScript instead of CoffeeScript for complete web app development?
Since you love FP I wanted to mention another option: LiveScript http://gkz.github.com/LiveScript/blog/functional-programming-in-javascript-using-livescript-and-prelude-ls.html http://gkz.github.com/LiveScript http://gkz.github.com/prelude-ls/ It's a script that compiles down to JavaScript. Inspired by CoffeeScript but Haskell and F# as well. Read the blog about it's FP capabilities. It fits with all JS/CS projects. Hope it helps. On Wednesday, June 13, 2012 10:57:40 PM UTC+2, Jacobo Polavieja wrote: > > Hi all, > > I've always developed desktop apps with the typical C/C++/C# stack and I > was willing to delve into web development. I really don't like Javascript > so I thought to give CoffeScript with node.js a chance, but as I love > functional programming the idea of using Clojure/Clojurescript for EVERY > part of the web app is enticing. > > If anyone with some practical experience could help me out in getting an > informed opinion, it'd be great. My questions are: > 1. I suppose you can't call any Java library from ClojureScript if you > want it to compile to JS. Can you call any Clojure library and have it > translated? > 2. If I'd create a DSL with Clojure, could it be deployed to JS through > ClojureScript also? > 3. One of my main concerns is that what drives me to start developing > client web apps is all the innovation and ideas that are being developed in > the JS ecosystem. As far as I've read ClojureScript can interact with JS > libraries, but seeing that the C2 library prefered to implement from > scratch with ClojureScript instead of wrapping D3, makes me wonder how easy > or convenient this is. I'd like to use things like Knockout but more > generally any good JS library that can come out (and also WebGL, the future > WebCL, etc)... > > From what I've investigated, I'd love to learn Clojure, I do know it would > help me have a better mental approach to the problems, but heavy client web > apps being my main short term focus I wonder if it's going to be more > hassle than opting for a more "direct" way using CoffeeScript with the rest > of JS ecosystem. > > I know the tooling is raw at the moment and that it'll get better > overtime, so I'm asking more about the fundamental problems that are hardly > going to be solved in the near time. > > Many many thanks to anyone who can shed some light as I sadly don't have > the time to experiment with both approaches. > > Cheers! > > -- 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: Difference between defrecord and extend
Dan, This difference is due to the subtleties around how protocols are implemented, and between passing a var vs. capturing a var's state at a particular time. If you change `transmogrify` to this (note the #'), the `(foo* (BarRec.))` succeeds: (def foo* (transmogrify #'foo "Bar")) Protocol implementations are largely tracked by a map held in a var corresponding to the protocol's name (in this case, FooProto). Prior to using `extend`, the #'FooProto var contains this map: {:on-interface user.FooProto, :on user.FooProto, :sigs {:foo {:doc "Make a foo", :arglists ([X Y]), :name foo}}, :var #'user/FooProto, :method-map {:foo :foo}, :method-builders {#'user/foo #}} After using `extend`, it contains this map (note the `:impls` slot): {:impls {user.BarRec {:foo #}}, :on-interface user.FooProto, :on user.FooProto, :sigs {:foo {:doc "Make a foo", :arglists ([X Y]), :name foo}}, :var #'user/FooProto, :method-map {:foo :foo}, :method-builders {#'user/foo #}} The implementation of protocol functions is such that they retain optimized (fixed) call paths for each type extended to their protocol. Thus, when you pass the value of `foo` to `transmogrify`, the un-extended protocol's "configuration" goes with it. However, if you pass the var #'foo instead, all calls through #'foo are guaranteed to utilize the most up-to-date protocol function, and therefore the most up-to-date protocol type extensions. In any case, calling `(foo …)` always works, because that call implicitly goes through #'foo anyway. The fine difference between capturing a var's value vs. passing or calling through the var itself is a frequent tripping hazard, but understanding it is especially important in ensuring maximum productivity and enjoyment in the REPL (as you've found out). FWIW, we talk about this issue with some simpler examples illustrating the subtleties in chapter 10 of the book (in a subsection of REPL-Oriented Programming, ~page 416, 'Understand when you’re capturing a value instead of dereferencing a var'). Hope this helps, - Chas -- http://cemerick.com [Clojure Programming from O'Reilly](http://www.clojurebook.com) On Jun 23, 2012, at 7:45 PM, Daniel Skarda wrote: > Hi, > > I have discovered strange difference between methods implemented directly in > defrecord and methods added later using extend (extend-type). > > I simplified the issue to code example listed bellow. Both records FooRec and > BarRec implement simple protocol FooProto with method foo. There is also evil > function transmogrify, which takes a function F and returns new function > which calls F. I use transmogrify to produce function foo* > > If you call foo method directly, everything works as expected. When you call > foo*, FooRec method is OK, but BarRec fails with following exception > > No implementation of method: :foo of protocol: #'user/FooProto found for > class: user.BarRec > > Which looks weird because you can call foo directly... > > I expect that defrecord and extend use different approach to extending the > type and foo* ends up with a reference to old version of protocol. > `defrecord` somehow manages to modify directly the protocol definition > referenced by foo*, while `extend` takes more immutable approach and replaces > old protocol definition (which foo* cannot see). I briefly dived into Clojure > sources and found that indeed `extend` ends with some sort of alter-root-var, > while `defrecord` traces ends deep in java sources (deftype*). > > It would be good idea to unify defrecord and extend so they have same > behaviour. > > Dan > > (defprotocol FooProto > (foo [X Y] "Make a foo")) > > (defn transmogrify [F Y] > (fn [A] (F A Y))) > > (def foo* (transmogrify foo "Bar")) > > (defrecord FooRec [] > FooProto > (foo [X Y] (println "Hello," Y))) > > (foo (FooRec.) "World") > ; -> Hello, World > > (foo* (FooRec.)) > ; -> Hello, Bar > > (defrecord BarRec []) > > (extend-type BarRec > FooProto > (foo [X Y] (println "Bar" Y))) > > (foo (BarRec.) "Bar") > ; -> Bar Bar > > (foo* (BarRec.)) > ; bang! > ; No implementation of method: :foo of protocol: #'user/FooProto found for > class: user.BarRec > > > -- > 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
slime-auto-connect for clojure-mode in Emacs
Hello Clojuriasts, This one is for the few aficionados of Emacs and the SLIME. I once got really tired of typing "M-x slime-connect RET RET ... etc." everytime I needed to bounce my VM in order to reconnect my Emacs to it. This happened often enough to me, because like Stuart (S) in a previous email, I also bork my VM on a regular basis and need to restart several times/coding session. So I came up with the following function, which uses the default connection values and tries to connect every second until it succeeds (I never shared it, but here it is anyhow): (defun slime-reconnect () "A more convenient function to reconnect to a LISP VM. This function uses the default parameters for the connection so you don't have to specify them, on failure waits and retries automatically until the connection succeeds (for slow VMs to start in the background), and saves and restores the window configuration to avoid showing the repl (you don't need it most of the time if you use SLIME)." (interactive) (slime-disconnect-all) (message "Connecting to Swank on port %S.." slime-port) (save-window-excursion (let ((count 0)) (while (not (condition-case nil (let* ((process (slime-net-connect slime-lisp-host slime-port slime-net-coding-system)) (slime-dispatching-connection process)) (slime-setup-connection process) ) (error ;;(message "Waiting for VM...") (sleep-for 0 700) (message (format "Attempting reconnection to Swank... (%s times)" count)) (setq count (1+ count) ) nil (sleep-for 0 300) ))) (defalias 'sc 'slime-reconnect) This did okay for a while, but unfortunately, that's a BLOCKING call, so your Emacs is frozen until your either interrupt it (C-g) or it succeeds once the slow-starting VM's Swank is ready. But it's still a bit annoying, you have to invoke it. So tonight I was mucking around with Emacs to make a globalized minor mode that automatically attempts to reconnect to a Clojure VM in the background, when it disconnects. Basically, you would enable something like "connected-minor-mode" and if you'd lose your connection (because you kill and restart your VM), Emacs would automatically attempt to reconnect to it. Minimal disturbance. I had it pretty much working, BUT... As I was rummaging in the SLIME, I found a nifty "slime-auto-connect" feature, which, upon evaluation of an expression, if a connection is not already established, will attempt to automatically start an inferior process for SLIME. This seemed to me a much more elegant solution to the previous "reconnecting attempts" idea... Unfortunately, this feature doesn't appear to support network connects to an already running Swank; SLIME supports an inferior process by default (via the "(slime)" command). The following tidbit of Elisp fixes this problem and modifies SLIME to make it possible to auto-connect to a Clojure VM: ;; Override the default command to support optinal network connection instead of ;; always just starting an inferior process.
[ANN] lib-noir 0.1.1
Chris Granger and I decided that a lot of the stuff in Noir is also useful outside of Noir, so I took a bunch of Noir's middleware and such and split it out into a new library called lib-noir. You can find it here: https://github.com/noir-clojure/lib-noir It has Noir's stateful session/flash middleware, cookie middleware, validation middleware, encryption utilities, and my personal favorite, some utilities for creating ring response maps (higher level than ring.util.response). All of these things are completely independent of Noir. They are can be used from any ring-based web framework, and my motivation for doing it was actually so I could use stateful sessions and the response utils in Compojure apps. These things will be maintained completely separately from noir from now on. The stateful session and flash stuff works mostly the same as sandbar's does, but sandbar tends to stay a little out of date, so hopefully this will make for a great alternative for people having issues with it. We hope you enjoy these things! ( First announcement on the Noir group: https://groups.google.com/d/topic/clj-noir/0BkySc8gG90/discussion ) -- 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