Trying out 1.3 alpha1
I updated my Clojure shootout web site benchmark programs so they worked on 1.3 alpha1, and ran them on 4 JVMs on 3 different OSs. The timing results are collected on the following ugly but quick-to-create- from-an-Excel-spreadsheet web page: http://homepage.mac.com/jafingerhut/files/clojure-benchmarks/results-java-clj-1.2-1.3a1.html That page also collects together timing results for the Java versions of the benchmark programs, and Clojure 1.2 run times. The Clojure programs are identical source code for 1.2 and 1.3 alpha1, but some have little macros like this so that the programs can be the same for both: ;; Handle slight difference in function name between Clojure 1.2.0 and ;; 1.3.0-alpha1. (defmacro my-unchecked-dec-int [& args] (if (and (== (*clojure-version* :major) 1) (== (*clojure-version* :minor) 2)) `(unchecked-dec ~...@args) `(unchecked-dec-int ~...@args))) I have not gone to any lengths to tweak the utmost performance out of these programs based on new features in 1.3 alpha1 -- I only made the changes needed to get them to compile without reflection warnings and run. (Detail: OK, there are a very few reflection warnings remaining, but they are in initialization code that has little effect on the total run time -- there are none in the inner loops where most of the run time is spent.) The far right columns compare the Clojure 1.2 and 1.3 alpha1 run times. 1.3 alpha1 is faster for some (negative percentages mean a reduction in run time from 1.2 to 1.3 alpha1), slower for others (positive percentages). All times are in seconds. Elapsed means wall clock time from start to finish, "user" is the total CPU time taken in user space, and "sys" is the system or kernel run time taken. (user+sys) can be more than elapsed if both of the 2 cores on my system were used in parallel for that particular program. The files and scripts used to create it are here on github: http://github.com/jafingerhut/clojure-benchmarks If you have git and want your own local copy to play with: git clone git://github.com/jafingerhut/clojure-benchmarks.git Unfortunately, the process of taking the timing results and putting them into the table are not automated, but just about everything before that is. As usual, any improvements to these programs are welcome. Andy -- 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
New Release of the Clojure Debugging Toolkit
As some of you know, I suffer from a seemingly interminable obsession with improving the Clojure debugging story. It just seems so clear to me that Clojure deserves a world class debugger, one befitting it's power, beauty and elegance. Maybe one day, we'll get there. Till then, here are my latest improvements to the CDT: 1. Stepping 2. Line number breakpoints 3. An Emacs based front end which allows you to: step, set breakpoints, catch exceptions, eval remote clojure expressions, and go up and down the stack, in a much more natural way than with just the command line. When you want to eval the s-expr under the cursor, hit ^x^a^p! CDT will then serialize the s-expr, send it to the remote vm, evaluate it there in the context of the current stack frame, and display the result on the mode line. Ridiculously long instructions on how to use it are here: http://georgejahad.com/clojure/emacs-cdt.html I should emphasize that there is nothing Emacs specific about the CDT. In fact, I've been so spoiled by Clojure, I don't even enjoy writing Elisp any more. This front end was written in Emacs because that's the IDE I'm most familiar with. The CDT command line is IDE agnostic; it should be easy, (dare I say fun?), to port it to other IDE's. If there's interest, I'll detail how in a future post. Many thanks to Fogus for the kind words, and to the Runa gang for their continuing encouragement! -- 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: question regarding macro (ab)usage
I hadn't time to read the whole post, but, I I understand it well, this snipset (defmacro with-context [options & body] `(let [context# (create-context options) thread# (create-thread context) sources# (atom {}) receivers# (atom {})] (binding [init-receiver (partial init-receiver-on context# receivers#) init-source (partial init-source-on context# sources#) publish (partial publish-on context# sources#) receiver (partial receive-on context# receivers#)] (try (do ~...@body) (finally ... close stuff, cleanup) can be written more or less: (defn with-context [options action] (let [context ..]) (binding [init-receiver .] (try (action) (finally ))) That can be called with (with-context options #(body)) You can then wrap this call in a macro to remove the #(). I am not sure it is a good idea, but it is always good to know for which precise feature you need the macro. Here tou need it to prevent to have to pass some code around as a function. That's one frequent usage of macro, it can help readability and (very little) performance. But depending of the situation. you might want to trade these advantages for composability and ease of programming. Best, Nicolas. -- 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 Emacs command to close the various balanced expressions in Clojure
Hi, blais is not talking 'bout openings, but closings. When you have this (the pipe symbol for the cursor position) : (def | foo [bar baz] (hello ) ) If you type ) You will have with paredit the cursor which jumps after the last closing paren, instead of just inserting this damn closing paren you wanted (it may not make sense for paredit, but maybe it makes sense for the typer : he's not in full control anymore). 2010/9/27 CuppoJava > I'm curious what you don't like about the automatic insertion scheme > that you talked about. I'm using Parenedit with emacs and I'm quite > happy with it. I think the scheme is quite simple... whenever you type > '(', it inserts ')'. Similarly with '[' and '{'. > -Patrick > > On Sep 26, 7:51 pm, blais wrote: > > Hi, > > > > Writing Clojure code tends to require a larger mix of "()", > > "[]" and "{}" characters than other LISPs I use. This > > sometimes makes it a bit tiring to write those balanced > > expressions. > > > > Writing balanced expressions has been addressed in editors > > mainly by providing the automated insertion of matching > > characters when you type an opening character. This kind of > > support usually also comes with a fancy overloading of the > > default insertion behaviour of those characters to > > automatically skip extraneous ones, locking you into keeping > > everything balanced all the time; I find this extremely > > distracting and annoying to use, because it changes the > > behaviour I expect from my editor (it doesn't *always* > > insert, it is deeply troubling to me). I've tried it, and I > > could not get used to it. > > > > I came up with what I see as a better solution, and it feels > > right to me: a simple command to automatically insert the > > "correct" closing character at the current cursor location. > > For example, invoking the same command 4 times when the cursor > > is at the '|' location in the following expression will do > > the right thing: > > > > (comment > > (use '[merced.testinput :only (protocol| > > > > results in: > > > > (comment > > (use '[merced.testinput :only (protocol)])) > > > > One advantage of this approach is the absence of "modality," > > i.e., the behaviour is the same in all contexts, e.g. when I > > type to insert, it always inserts. The new command means > > "insert to close the sequence here, whatever the sequence > > character is." > > > > If you want to try it, here is the corresponding Emacs code: > > > > (defvar close-matching-chars > > '( (?( . ?)) > >(?[ . ?]) > >(?{ . ?}) > >(?< . >}) > >)) > > > > (defun close-matching () > > "Close with the most appropriate matching balanced character." > > (interactive) > > ;; Scan backwards until it stops. > > (let ((c (save-excursion > >(while (ignore-errors (forward-sexp -1) (not (<= > > (point) 1 > >(backward-char 1) > >(string-to-char (thing-at-point 'char)) > >))) > > (insert-char (cdr (assoc c close-matching-chars)) 1) > > )) > > > > Bind it to your favourite key (I use 'Ctrl-)' ): > > > > (global-set-key [(control \))] 'close-matching) > > > > Have fun, > > -- > 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: An Emacs command to close the various balanced expressions in Clojure
2010/9/27 Tassilo Horn > Hi, > > did you already try out paredit [1]? That mode is absolutely fabulous > for programming any lisp and provides much more than just closing > parens. > My bet is that it's exactly paredit's behavior the OP is complaining about. We had the same discussions in counterclockwise, when I introduced paredit behavior. The problem is not that paredits commands aren't useful. They are ! The problem is that certain people don't want any paredit command bound to "regular keystrokes". They want paredit out of their way when they are typing. They just want paredit commands accessible through command shortcuts. Think vim-like processing : when in "typing" mode, you cannot invoke any command available. You must enter the command mode before entering commands. We found *a* solution for Counterclockwise : The "Structural edition" (aka paredit's) commands are always available in the editor via keyboard shortcuts, but there are two modes: * the "default mode" : (default as in "configured by default in a fresh ccw installation") *no* command is bound to regular keystrokes. a "(" inserts a "(" (and not its balanced ")"). a "]" inserts a "]" (and does not jump to the end of the closing enclosing form). Period. * the "strict mode" : (strict as in "does its best to always confine/guide the user into strict structural edition") . In this mode, you guessed it, you get the usual paredit commands bound to keystroke, plus some extras : do a valid selection of form or sibling forms: hit some opening "paren" ( [ { and it automatically wraps the selected form(s) with the appropriate kind of brackets. etc. In ccw, even in strict mode, you can go away from the strict mode for the following keystroke: just hit escape and the next keystroke will bypass strict mode's command binding. Finally, you can jump back and forth default/strict mode via the "Alt+D" keyboard shortcut. Sorry if in the end of my answer I somehow hijacked the thread, but I thought this may be of interest to some. -- Laurent > > Give it a shot! > > Bye, > Tassilo > > Footnotes: > [1] http://mumble.net/~campbell/emacs/paredit.el > > -- > 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: New Release of the Clojure Debugging Toolkit
2010/9/28 George Jahad > As some of you know, I suffer from a seemingly interminable obsession > with improving the Clojure debugging story. It just seems so clear to > me that Clojure deserves a world class debugger, one befitting it's > power, beauty and elegance. Maybe one day, we'll get there. Till > then, here are my latest improvements to the CDT: > > 1. Stepping > 2. Line number breakpoints > 3. An Emacs based front end which allows you to: step, set > breakpoints, catch exceptions, eval remote clojure expressions, and go > up and down the stack, in a much more natural way than with just the > command line. > > When you want to eval the s-expr under the cursor, hit ^x^a^p! > > CDT will then serialize the s-expr, send it to the remote vm, evaluate > it there in the context of the current stack frame, and display the > result on the mode line. > > Ridiculously long instructions on how to use it are here: > http://georgejahad.com/clojure/emacs-cdt.html > > I should emphasize that there is nothing Emacs specific about the > CDT. In fact, I've been so spoiled by Clojure, I don't even enjoy > writing Elisp any more. This front end was written in Emacs because > that's the IDE I'm most familiar with. The CDT command line is IDE > agnostic; it should be easy, (dare I say fun?), to port it to other > IDE's. If there's interest, I'll detail how in a future post. > Oooh yes ! > > Many thanks to Fogus for the kind words, and to the Runa gang for > their continuing encouragement! > > -- > 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: New Release of the Clojure Debugging Toolkit
Wow, looks very useful. Quickly perusing the 'ridiculously long instructions' it seems that it isn't compatible with slime. Is this the case? Does slime fit into your workflow, and if so, how? Sam --- http://sam.aaron.name On 28 Sep 2010, at 9.08 am, Laurent PETIT wrote: > 2010/9/28 George Jahad > >> As some of you know, I suffer from a seemingly interminable obsession >> with improving the Clojure debugging story. It just seems so clear to >> me that Clojure deserves a world class debugger, one befitting it's >> power, beauty and elegance. Maybe one day, we'll get there. Till >> then, here are my latest improvements to the CDT: >> >> 1. Stepping >> 2. Line number breakpoints >> 3. An Emacs based front end which allows you to: step, set >> breakpoints, catch exceptions, eval remote clojure expressions, and go >> up and down the stack, in a much more natural way than with just the >> command line. >> >> When you want to eval the s-expr under the cursor, hit ^x^a^p! >> >> CDT will then serialize the s-expr, send it to the remote vm, evaluate >> it there in the context of the current stack frame, and display the >> result on the mode line. >> >> Ridiculously long instructions on how to use it are here: >> http://georgejahad.com/clojure/emacs-cdt.html >> >> I should emphasize that there is nothing Emacs specific about the >> CDT. In fact, I've been so spoiled by Clojure, I don't even enjoy >> writing Elisp any more. This front end was written in Emacs because >> that's the IDE I'm most familiar with. The CDT command line is IDE >> agnostic; it should be easy, (dare I say fun?), to port it to other >> IDE's. If there's interest, I'll detail how in a future post. >> > > Oooh yes ! > > >> >> Many thanks to Fogus for the kind words, and to the Runa gang for >> their continuing encouragement! >> >> -- >> 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
Re: New Release of the Clojure Debugging Toolkit
I regularly use both simultaneously. While Slime and the CDT don't currently leverage each other, they don't interfere with each other either as far as I know, unless you happen to suspend the swank server thread. Not sure what all the implications of that are. I'm still learning. Why do you ask? Is there some particular functionality you are interested in? When I want to use both simultaneously, I eval this in my .emacs: (setq swank-clojure-extra-vm-args '("- agentlib:jdwp=transport=dt_socket,address=8021,server=y,suspend=n")) hth, g On Sep 28, 2:17 am, Sam Aaron wrote: > Wow, looks very useful. Quickly perusing the 'ridiculously long instructions' > it seems that it isn't compatible with slime. > > Is this the case? Does slime fit into your workflow, and if so, how? > > Sam > > ---http://sam.aaron.name > > On 28 Sep 2010, at 9.08 am, Laurent PETIT wrote: > > > 2010/9/28 George Jahad > > >> As some of you know, I suffer from a seemingly interminable obsession > >> with improving the Clojure debugging story. It just seems so clear to > >> me that Clojure deserves a world class debugger, one befitting it's > >> power, beauty and elegance. Maybe one day, we'll get there. Till > >> then, here are my latest improvements to the CDT: > > >> 1. Stepping > >> 2. Line number breakpoints > >> 3. An Emacs based front end which allows you to: step, set > >> breakpoints, catch exceptions, eval remote clojure expressions, and go > >> up and down the stack, in a much more natural way than with just the > >> command line. > > >> When you want to eval the s-expr under the cursor, hit ^x^a^p! > > >> CDT will then serialize the s-expr, send it to the remote vm, evaluate > >> it there in the context of the current stack frame, and display the > >> result on the mode line. > > >> Ridiculously long instructions on how to use it are here: > >>http://georgejahad.com/clojure/emacs-cdt.html > > >> I should emphasize that there is nothing Emacs specific about the > >> CDT. In fact, I've been so spoiled by Clojure, I don't even enjoy > >> writing Elisp any more. This front end was written in Emacs because > >> that's the IDE I'm most familiar with. The CDT command line is IDE > >> agnostic; it should be easy, (dare I say fun?), to port it to other > >> IDE's. If there's interest, I'll detail how in a future post. > > > Oooh yes ! > > >> Many thanks to Fogus for the kind words, and to the Runa gang for > >> their continuing encouragement! > > >> -- > >> 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
Re: How often do you use REPL?
My standard practice is to split the (Emacs) screen, one side is a Clojure mode edit session, the other a repl. Best of both worlds. One can easily build up complex expressions as required, and still easily evaluate expressions in either side of the screen. If you are not familiar with Emacs and want to see how this works, check out Craig Andera's screencasts at http://www.pluralsight-training.net/microsoft/olt/course/toc.aspx?n=clojure-concurrency-tutorial . He uses the same approach. These screencasts are well worth watching, BTW. Good stuff. On Sep 27, 3:14 pm, Christian Guimaraes wrote: > It's a noob question... I know > > But in my studies I use REPL 80% of the coding time. > > More advanced users still uses REPL so many times? -- 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: New Release of the Clojure Debugging Toolkit
On 28 Sep 2010, at 11.20 am, George Jahad wrote: > Why do you ask? Is there some particular functionality you are > interested in? Well, I'm just learning too. Currently I rely on lein swank to start up my JVM so that slime can connect to it. CDT seems to want you to manually start up the JVM with a particular set of flags. So, do you therefore use two JVM instances? I guess I could do with sitting and pairing for 10 mins to see how things work ;-) Is there any chance you could record a short screencast of this stuff in action? 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: How often do you use REPL?
On Tue, Sep 28, 2010 at 12:03 PM, David Cabana wrote: > My standard practice is to split the (Emacs) screen, one side is a > Clojure mode edit session, the other a repl. Best of both worlds. > One can easily build up complex expressions as required, and still > easily evaluate expressions in either side of the screen. > > Same here. Dream of having a bigger screen to have more than one file and a REPL. Use REPL all the time to test function and to try expression while waiting complex functions. -- 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
swank-clojure-1.1.0.jar
Hello all, Where can I download swank-clojure-1.1.0.jar? My attempts to compile (using lein jar) are failing. I think is due to the repositories location. Or, better, how can I fix the repositories in the swank-clojure code. Thanks. -- christian guimaraes -- 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: New Release of the Clojure Debugging Toolkit
>> Why do you ask? Is there some particular functionality you are >> interested in? > > Well, I'm just learning too. Currently I rely on lein swank to start up my > JVM so that slime can connect to it. CDT seems to want you to manually start > up the JVM with a particular set of flags. So, do you therefore use two JVM > instances? > > I guess I could do with sitting and pairing for 10 mins to see how things > work ;-) > > Is there any chance you could record a short screencast of this stuff in > action? Leiningen honours the JAVA_OPTS environment variable. If you do this - $ export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8021" $ lein swank Then lein will start the JVM with the required flags. After that, there is no reason why CDT shouldn't work. 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
examples of clojure code
Dear all , any link where to find examples of clojure code used in business appl. , domain model , etc thanks abraham -- 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
lein > swank > Aquamacs > slime-connect test failed. Help!
I'm new at clojure+emacs+slime+swank+leiningen and I wanted to run a (simple?) test that goes like this: $ lein new test-project; cd test-project $ cat > ./src/core.clj (ns test-project.core) (def *argh* 1) ; loop, printing *argh* every sec, for 100 secs (loop [i 0] (if (= i 100) (println "OK.") (do (println *argh*) (. Thread (sleep 1000)) (recur (+ i 1) Then, to test core.clj, I ran it from the command line: $ clj ./src/core.clj 1 1 1 etc. OK. Then, I did: $ lein swank user=> Connection opened on local port 4005 # First question: why no visible output? Still hoping, I launched emacs (actually Aquamacs, cuz I'm not that comfortable with yanking) and: 1. opened test-project/src/test_project/core.clj 2. M-x slime-connect Versions differ: 2010-09-22 (slime) vs. 20100404 (swank). Continue? (y or no) Hem. Why that? Plus, no output in the slime buffer. Just an REPL prompt. And a non-responsive one at that (I can type but nothing that I type is interpreted). So, just a prompt, really. 3. in the core.clj buffer, changed value of *arhg* to 2, placed cursor at the end of this, and evaluated the expression (^X ^E). No change on the slime-repl clojure side. I realize how little I understand about all this but would love to get started. Any advice much appreciated. Thanks Alex -- 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: Fighting with Emacs ;-)
I could do this, but right now I'm just playing with C-c C-r to evaluate regions, instead of compiling the entire file. And I'd swear this used to put the evaluation in the REPL. On Sep 27, 10:59 pm, Alan wrote: > C-c C-k in the .clj buffer is easier and equivalent (or at least very > similar) > > On Sep 27, 12:27 pm, Linus Ericsson > wrote: > > > > > I recognize that one. The repl haven't loaded the file your editing. > > > My (temporary) solution is to do a (load-file "") > > after each edit that I want to debug, but that's a bit boring. I guess there > > is some kind of reload feature somewhere... > > > /Linus > > > 2010/9/27 psfblair > > > > I found the old thread below, but unfortunately the solution isn't > > > working for me. If I have a foo.clj file in a buffer and evaluate > > > region on > > > > (defn foo [] (+ 1 2)) > > > > I get > > > > #'user/foo in the minibuffer. If I then evaluate region on > > > > (foo) > > > > I get 3 in the minibuffer. The slime REPL is giving me a prompt user> > > > so I'm assuming it's in the user namespace, but I can't seem to get > > > expressions from the text buffer to evaluate in there. > > > > On Mar 28, 5:01 am, Michał Marczyk wrote: > > > > > On 27 March 2010 22:25, alux wrote: > > > > > > But now I see people use the result of this evaluation in their REPL > > > > > (I see this in videos, so I cant ask 'em :). This doesnt work at all > > > > > for me. I get the result in the minibuffer (this thing at the very > > > > > bottom) and thats it. > > > > > If the form you evaluate is of the def* variety, it's going to affect > > > > the namespace it resides in and not the namespace of the REPL. Thus, > > > > if you have e.g. (ns foo) at the top of the file, yet you're working > > > > in the user namespace at the REPL, then after using C-x C-e to > > > > evaluate a function definition in your file, you'll have to say > > > > something like foo/bar to reach it from the REPL. (Or (use :reload-all > > > > 'foo), if you prefer.) > > > > > If there is no namespace declaration in the file, then the expression > > > > will be evaluated in the user namespace, which means that you'll be > > > > able to use it straight away if that's your REPL's namespace. (If you > > > > say (in-ns 'foo) or (ns foo) at the REPL, then you'll have to say > > > > something like user/bar to reach your function.) > > > > > Sincerely, > > > > Michał > > > > -- > > > 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: Fighting with Emacs ;-)
I'm just doing simple Clojure exercises with simple evaluations of regions in the .clj buffer. I don't have an ns form, but I was under the impression that this put me in the user namespace, which is what my REPL is in. If I evaluate *ns* in the .clj buffer I get # in the minibuffer, and I get the same when evaluating *ns* in the SLIME buffer. Is it possible that this is some kind of mismatch between Unicode and ASCII? On Sep 28, 3:16 am, Phil Hagelberg wrote: > On Mon, Sep 27, 2010 at 4:03 AM, psfblair wrote: > > I found the old thread below, but unfortunately the solution isn't > > working for me. If I have a foo.clj file in a buffer and evaluate > > region on > > > (defn foo [] (+ 1 2)) > > > I get > > > #'user/foo in the minibuffer. > > What does your ns form look like? SLIME uses a regex to determine the > namespace; it could be that your ns form isn't getting caught by it. > > -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: ANN: textmate-clojure, SLIME for TextMate (sorta)
Awesome ! On Sep 24, 4:39 am, David Nolen wrote: > First off Acknowledgements: > > Aria Haghighi, did much of the heavy lifting on this project! > Stephen Roller, created the first version of the bundle in 2008 > Mark McGranaghan, expanded Stephen Roller's version > Justin Balthrop & Lance Bradley, core developers of > Cakehttp://github.com/ninjudd/cake- if they weren't constantly adding features > just for this project, this would have never gotten off the ground > Allan Odgaard, for being the creator of TextMate and listening to my Bundle > dev noob questions > > A screencast:http://blip.tv/file/4160578 > The project repo:http://github.com/swannodette/textmate-clojure > The Google Group:http://groups.google.com/group/textmate-clojure > > The project is written almost entirely in Clojure so you have no excuse to > not contribute if you like TextMate :D > > Lots of bugs to fix. Two things I'd love to see: > > 1. Integration with nREPL via WebSockets to get a REPL right in TextMate > 2. Integration with Mycroft to get an inspector right in TextMate > > David -- 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 Cookbook
Indeed. Similar functionality will be implemented in cake very soon. On Sep 27, 8:54 pm, Scott Jaderholm wrote: > Daniel, > > If you install lein-search > (http://clojars.org/lein-searchorhttp://github.com/Licenser/lein-search) you > can do searches like that. > > lein search mail > > If you put it in ~/.lein/plugins it will work for all your lein projects and > you can even use it to add what you find to your project.clj and to go > through all your dependencies and prompt whether your want to update. > > Scott > > On Mon, Sep 27, 2010 at 10:01 AM, Daniel Pittman wrote: > > > > > Tim Daly writes: > > > > There is a movement afoot in the common lisp community to implement > > > quicklisp which is similar to the perl cpan site or debian. It would be > > > useful if there was a quicklisp (or asdf) for Clojure. Thus you could > > > "apt-get" a library for clojure. > > > FWIW, having just started out playing with Clojure with a view to building > > a > > Google App Engine web service — and from a Perl and Debian background: > > > The single biggest thing that I have missed has been 'lein search' or so, > > which would allow me to search an index of the modules it can access and > > tell > > me what is available for meeting my current need. > > > The second biggest is the lack of a CPAN-alike central service on the web > > that > > would allow me to do the same, plus review the documentation for candidate > > libraries. > > > So, um, that would be nice. :) > > > Daniel > > -- > > ✣ Daniel Pittman ✉ dan...@rimspace.net ☎ +61 401 155 > > 707 > > ♽ 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 -- 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: Fighting with Emacs ;-)
On Tue, 28 Sep 2010 03:58:56 -0700 (PDT) psfblair wrote: > I could do this, but right now I'm just playing with C-c C-r to > evaluate regions, instead of compiling the entire file. And I'd swear > this used to put the evaluation in the REPL. > > On Sep 27, 10:59 pm, Alan wrote: > > C-c C-k in the .clj buffer is easier and equivalent (or at least very > > similar) > > > > On Sep 27, 12:27 pm, Linus Ericsson > > wrote: > > > > > > > > > I recognize that one. The repl haven't loaded the file your editing. > > > > > My (temporary) solution is to do a (load-file "") > > > after each edit that I want to debug, but that's a bit boring. I guess > > > there > > > is some kind of reload feature somewhere... > > > > > /Linus > > > > > 2010/9/27 psfblair > > > > > > I found the old thread below, but unfortunately the solution isn't > > > > working for me. If I have a foo.clj file in a buffer and evaluate > > > > region on > > > > > > (defn foo [] (+ 1 2)) > > > > > > I get > > > > > > #'user/foo in the minibuffer. If I then evaluate region on > > > > > > (foo) > > > > > > I get 3 in the minibuffer. The slime REPL is giving me a prompt user> > > > > so I'm assuming it's in the user namespace, but I can't seem to get > > > > expressions from the text buffer to evaluate in there. > > > > > > On Mar 28, 5:01 am, Michał Marczyk wrote: > > > > > > > On 27 March 2010 22:25, alux wrote: > > > > > > > > But now I see people use the result of this evaluation in their REPL > > > > > > (I see this in videos, so I cant ask 'em :). This doesnt work at all > > > > > > for me. I get the result in the minibuffer (this thing at the very > > > > > > bottom) and thats it. > > > > > > > If the form you evaluate is of the def* variety, it's going to affect > > > > > the namespace it resides in and not the namespace of the REPL. Thus, > > > > > if you have e.g. (ns foo) at the top of the file, yet you're working > > > > > in the user namespace at the REPL, then after using C-x C-e to > > > > > evaluate a function definition in your file, you'll have to say > > > > > something like foo/bar to reach it from the REPL. (Or (use :reload-all > > > > > 'foo), if you prefer.) > > > > > > > If there is no namespace declaration in the file, then the expression > > > > > will be evaluated in the user namespace, which means that you'll be > > > > > able to use it straight away if that's your REPL's namespace. (If you > > > > > say (in-ns 'foo) or (ns foo) at the REPL, then you'll have to say > > > > > something like user/bar to reach your function.) > > > > > > > Sincerely, > > > > > Michał > > > > > > -- > > > > 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 > Actually, this sounds like standard behavior for an integrated EMACS/REPL to me: "sending" code from the edited file to the REPL evaluates them in the REPL, but doesn't print them: you either get a message in the minibuffer or a short note in the buffer. Normal usage is to edit a function, send it to the REPL, then switch to the repl and test the newly defined function(s) (usually just M-p to recall the just failed test). In particular, SWANK/SLIME prints the value of the last expression in the evaluate region in the minibuffer. At least, that's what' it's always done for me. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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: exception thrown when passing in nil parameter
yeah, that's what i was thinking of doing, but it didn't seem pretty. thanks! On Sep 27, 5:30 pm, Stuart Sierra wrote: > Here's one popular form: > > (defn foo > ([a b c] (foo a b c nil)) > ([a b c d] (if d ...))) > > Most multi-arity functions have the same behavior for every arity, > with some default argument values. > > -S > > On Sep 27, 2:13 pm, Glen Rubin wrote: > > > > > I have a function that will accept 3 or 4 parameters. Another > > function I have calls it and passes in 4 arguments. Sometimes, the > > 4th argument is nil and this causes an error, instead of just calling > > the main function as if I passed in 3 arguments. Meaning the main > > function sees a 4th parameter with nil value. How do I get it to act > > as only 3 parameters were passed in this circumstance? thx- Hide quoted > > text - > > - Show quoted text - -- 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: swank-clojure-1.1.0.jar
Christian Guimaraes wrote: > Hello all, > > Where can I download swank-clojure-1.1.0.jar? My attempts to compile (using > lein jar) are failing. I think is due to the repositories location. > > Or, better, how can I fix the repositories in the swank-clojure code. > > Thanks. > > -- christian guimaraes Don't think swank-clojure 1.1.0 was available as a lein dependency, since back then it was mixed in with emacs lisp stuff. Any reason you're not using 1.2.1 or the latest snapshot? If you really need a 1.1.0 jar, you should be able to build it from http://github.com/technomancy/swank-clojure/tree/1.1.0 Joost. -- 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: New Release of the Clojure Debugging Toolkit
On Tue, Sep 28, 2010 at 3:40 AM, George Jahad wrote: > As some of you know, I suffer from a seemingly interminable obsession > with improving the Clojure debugging story. It just seems so clear to > me that Clojure deserves a world class debugger, one befitting it's > power, beauty and elegance. Maybe one day, we'll get there. Till > then, here are my latest improvements to the CDT: > Great stuff! Would it be possible to write a version of the tutorial that shows how to accomplish the same things purely from the command line? While I love Emacs as much as the next guy, I think a tutorial that shows how to debug using only the CDT REPL would be useful to many people. David -- 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: Trying out 1.3 alpha1
On Tue, Sep 28, 2010 at 3:29 AM, Andy Fingerhut wrote: > I updated my Clojure shootout web site benchmark programs so they worked on > 1.3 alpha1, and ran them on 4 JVMs on 3 different OSs. The timing results > are collected on the following ugly but > quick-to-create-from-an-Excel-spreadsheet web page: > > > http://homepage.mac.com/jafingerhut/files/clojure-benchmarks/results-java-clj-1.2-1.3a1.html > > That page also collects together timing results for the Java versions of > the benchmark programs, and Clojure 1.2 run times. The Clojure programs are > identical source code for 1.2 and 1.3 alpha1, but some have little macros > like this so that the programs can be the same for both: > Thanks for keeping this going! David -- 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: New Release of the Clojure Debugging Toolkit
George, > As some of you know, I suffer from a seemingly interminable obsession > with improving the Clojure debugging story. It just seems so clear to > me that Clojure deserves a world class debugger, one befitting it's > power, beauty and elegance. Maybe one day, we'll get there. Till > then, here are my latest improvements to the CDT: Tried it out just now. Works as advertised. Will dive deeper in a while. Clojure deserves a great debugging infrastructure. I believe CDT is a big step in the right direction. Thanks a lot, George! 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: swank-clojure-1.1.0.jar
Hi, the problem is the (concat "http://repo.technomancy.us/"; "swank-clojure-1.1.0.jar") in the swank-clojure.el this repo no longer exists. -- christian On Tue, Sep 28, 2010 at 12:59 PM, Joost wrote: > > > Christian Guimaraes wrote: > > Hello all, > > > > Where can I download swank-clojure-1.1.0.jar? My attempts to compile > (using > > lein jar) are failing. I think is due to the repositories location. > > > > Or, better, how can I fix the repositories in the swank-clojure code. > > > > Thanks. > > > > -- christian guimaraes > > Don't think swank-clojure 1.1.0 was available as a lein dependency, > since back then it was mixed in with emacs lisp stuff. Any reason > you're not using 1.2.1 or the latest snapshot? > > If you really need a 1.1.0 jar, you should be able to build it from > http://github.com/technomancy/swank-clojure/tree/1.1.0 > > Joost. > > -- > 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: swank-clojure-1.1.0.jar
Christian Guimaraes wrote: > Hi, > > the problem is the > > (concat "http://repo.technomancy.us/"; > "swank-clojure-1.1.0.jar") > > in the swank-clojure.el > > this repo no longer exists. > > -- christian That's because swank-clojure.el no longer exists and is no longer supported. swank-clojure now works "out of the box" with recent-ish versions of slime. If you must, you'll have build and install 1.1.0 yourself. But I seriously suggest you upgrade to the latest stable release (using leiningen or maven) as documented on http://github.com/technomancy/swank-clojure Also note that there is a separate swank-clojure group at http://groups.google.com/group/swank-clojure -- 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: Conduit - Stream processing Clojure
I'm pleased to announce a new library for stream processing in Clojure called Conduit. Stream processing concepts are described in the book "Enterprise Integration Patterns" and the Apache Camel project is a stream processing library for Java. This library is intended to abstract away the 'plumbing' parts of your distributed app and let you focus just on the interesting parts. An intro is here: http://intensivesystems.net/tutorials/conduit-motive.html API documentation is here: http://intensivesystems.net/tutorials/stream_proc.htm http://intensivesystems.net/tutorials/streams2.html And how to use Conduit with RabbitMQ is described here: http://intensivesystems.net/tutorials/rabbitmq-conduit.html This is also what I'm going to be presenting at StrangeLoop in a couple of weeks. http://strangeloop2010.com Jim -- 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: examples of clojure code
There is the "ANN: Clojure Cookbook" thread that Dave Sletten just posted, where he points out a new Clojure Cookbook he's working on: http://www.gettingclojure.com/cookbook:clojure-cookbook Tim On Tue, Sep 28, 2010 at 4:10 AM, Abraham wrote: > Dear all , > > any link where to find examples of clojure code used in business > appl. , domain model , etc > > thanks > abraham > > -- > 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
Looking for more affordable sleeping options for clojure-conj
Hey guys, I'm looking for one of the following more affordable sleeping options at clojure-conj (Thu, Fri, and Sat nights): 1) Someone willing to gift or rent space for an air mattress in their room. 2) Someone with a king w/ sofa bed room willing to rent out the sofa bed. 3) Someone interested in splitting one of the rooms with two double beds. 4) Someone who lives close by willing to let me {sofa, air mattress} Thanks, Scott -- 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 Emacs command to close the various balanced expressions in Clojure
The message below pretty much sums it up. My original problem with paredit and such is that it creates "modality", that is, the behaviour of insertion depends on the context. This variable behaviour, this "modality problem" is what Jef Raskin talks about in "The Humane Interface" (a truly enlightening book BTW). This is what makes us slow at using certain programs. In other words, when I type a character to insert, I want it to always insert; this behaviour is predictable and causes the least amout of surprise. Also, I feel that the command I submitted deals with 90% of the missing feature support I need for writing balancing expressions; everything else is trivial IMO (Emacs already deals with indenting, skipping and selection of balanced expressions better than anything else). I'm sure you can get used to anything though, but in my very personal experience, the less "magic", the better. Feel free to use or discard, but if you install it I'll bet it'll grow on you. On Sep 28, 4:07 am, Laurent PETIT wrote: > 2010/9/27 Tassilo Horn > > > Hi, > > > did you already try out paredit [1]? That mode is absolutely fabulous > > for programming any lisp and provides much more than just closing > > parens. > > My bet is that it's exactly paredit's behavior the OP is complaining about. > > We had the same discussions in counterclockwise, when I introduced paredit > behavior. > > The problem is not that paredits commands aren't useful. They are ! > > The problem is that certain people don't want any paredit command bound to > "regular keystrokes". They want paredit out of their way when they are > typing. They just want paredit commands accessible through command > shortcuts. > Think vim-like processing : when in "typing" mode, you cannot invoke any > command available. You must enter the command mode before entering commands. > > We found *a* solution for Counterclockwise : > > The "Structural edition" (aka paredit's) commands are always available in > the editor via keyboard shortcuts, > but there are two modes: > > * the "default mode" : (default as in "configured by default in a fresh > ccw installation") *no* command is bound to regular keystrokes. a "(" > inserts a "(" (and not its balanced ")"). a "]" inserts a "]" (and does not > jump to the end of the closing enclosing form). Period. > * the "strict mode" : (strict as in "does its best to always confine/guide > the user into strict structural edition") . In this mode, you guessed it, > you get the usual paredit commands bound to keystroke, plus some extras : do > a valid selection of form or sibling forms: hit some opening "paren" ( [ { > and it automatically wraps the selected form(s) with the appropriate kind of > brackets. etc. > > In ccw, even in strict mode, you can go away from the strict mode for the > following keystroke: just hit escape and the next keystroke will bypass > strict mode's command binding. > Finally, you can jump back and forth default/strict mode via the "Alt+D" > keyboard shortcut. > > Sorry if in the end of my answer I somehow hijacked the thread, but I > thought this may be of interest to some. > > -- > Laurent > > > > > Give it a shot! > > > Bye, > > Tassilo > > > Footnotes: > > [1] http://mumble.net/~campbell/emacs/paredit.el > > > -- > > 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: Problems Running tests with fixtures
your test has no (is ...) On Mon, Sep 27, 2010 at 5:16 PM, Timothy Washington wrote: > I suppose I've been looking at this code for too long, so I need a 2nd pair > of eyes on it. I'm not getting some 'test.is' code to run. I'm trying to run > the tests as in fig. 1. Suppose the tests are defined in a file called > utests.clj (fig. 2). > > (use 'clojure.test) > (require 'utests) > (run-tests 'utests) > fig. 1 - run attempts > > (ns utests) > (defn test-fixture-1 [test-func] > > (setup-code) > (test-func) > (teardown-code) > ) > (use-fixtures :each test-fixture-1) > (deftest test-code [] > (= 5 5)) > ) > fig. 2 - utests.clj > > Ran 0 tests containing 0 assertions. > 0 failures, 0 errors. > {:type :summary, :test 0, :pass 0, :fail 0, :error 0} > fig. 3 - output > > > Q. The thing that I'm missing is... > > Thanks in advance > Tim > > -- > 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: An Emacs command to close the various balanced expressions in Clojure
On Sep 26, 2010, at 6:51 PM, blais wrote: > Writing Clojure code tends to require a larger mix of "()", > "[]" and "{}" characters than other LISPs I use. This > sometimes makes it a bit tiring to write those balanced > expressions. For outer expressions I tend to use the verbose forms (hash-map ...) and (vector ...) for aesthetic reasons, so {} and [] mostly occur around innermost expressions in my code. Then balancing the remaining parens is just a matter of hitting ')' until Vim highlights the outermost paren for me. But I might find a feature like yours useful; does anybody know of an equivalent for Vim? -- 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 Emacs command to close the various balanced expressions in Clojure
Hi, Am 28.09.2010 um 19:07 schrieb Michael Gardner: > Does anybody know of an equivalent for Vim? Not yet, but it is on the radar for VC now. :) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members 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: Looking for more affordable sleeping options for clojure-conj
Maybe http://www.couchsurfing.org/ will be of help? On Sep 28, 6:58 am, Scott Jaderholm wrote: > Hey guys, > > I'm looking for one of the following more affordable sleeping options at > clojure-conj (Thu, Fri, and Sat nights): > > 1) Someone willing to gift or rent space for an air mattress in their room. > > 2) Someone with a king w/ sofa bed room willing to rent out the sofa bed. > > 3) Someone interested in splitting one of the rooms with two double beds. > > 4) Someone who lives close by willing to let me {sofa, air mattress} > > Thanks, > Scott -- 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
namespace aesthetics in chemiclj
I've been working on a library for representing molecules, atoms, chemical bonds, etc... called chemiclj ( http://github.com/slyrus/chemiclj ) and I've run into a design issue that has flummoxed me for a few weeks. I've written up a blog post that goes into more detail ( http://slyrus.github.com/2010/08/27/chemiclj-namespaces.html ) but the short version is that I'd like to be able to have an "external" interface, defined by things that live in defprotocols, I'd like to have a "private"-ish implementation of records that implement (is that the right term?) these protocols, and then I'd like to have some "external" helper/constructor functions for creating instances of these record types. It seemed like the clojure-y thing to do here would be to have a chemiclj.core package that defines the protocols, and to have chemiclj.atom and chemiclj.molecule for the details of atoms and molecules, respectively. But then how to get the make-atom function, for instance, defined in the chemiclj.core namespace _after_ the chemiclj.atom has been loaded? The approach I've come up with is to make a defn* macro that defines a function in the specified package: (defmacro defn* [fn-name & rest] `(intern (if ~(namespace fn-name) (symbol ~(namespace fn-name)) (ns-name *ns*)) (symbol ~(name fn-name)) (fn ~(symbol (name fn-name)) ~...@rest))) and then in another ns, say chemiclj.molecule, one could do: (defn* chemiclj.core/molecular-formula [mol] (apply str (map #(str (:id (first %)) (second %)) (sort-by #(:id (first %)) (count-elements mol) which would cause molecular-formula to be defined in the chemiclj.core ns. This, along with some load forms from the core.clj lets things work as I expect/intend, but it's somewhat hacky/ugly. I was wondering if others have run into similar ordering issues brought about by protocols/records/nses and if anyone has any suggestions on what good clojure design aesthetics suggest here. Thanks, Cyrus -- 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: question regarding macro (ab)usage
thanks for the lengthy reply! i will play around with these suggestions. like the fact there are less parameters to pass around. On Tue, Sep 28, 2010 at 1:10 AM, Meikel Brandmeyer wrote: > Hi, > > I'm not sure my solution is 100% idiomatic, but has some advantages. > General strategy: minimise macro usage. Macros are cool, but > overrated. Put as much as possible into functions. This has several > advantages like easier testing, less macro trap doors, better > readability (no # all over the place) or possibility of hotfixing of > eg. the cleanup code in with-context[1], etc. > > So my plan is: put everything in special global variables. Expose them > as options for the functions. The defaults refer to the global > variables which are set with binding. So allows for usage pattern, but > could also allow for easy testing. > > (with-context [:some option] > (init-source "bla" :some "option")) > > or > > (init-source "bla" :some "option" :context manually-crafted-context) > > Here is my try: > > (declare *context* *thread* *receivers* *sources*) > > (defn init-receiver > [topic & {:keys [context receivers] > :or {context *content* receivers *receivers*} > :as options}] > ...boring java stuff) > > (defn init-source > [topic & {:keys [context sources] > :or {context *content* sources *sources*} > :as options}] > ...boring java stuff) > > (defn publish > [topic message & {:keys [context sources] > :or {context *content* sources *sources*} > :as options}] > ...boring java stuff) > > (defn receive > [topic func & {:keys [context receivers] > :or {context *content* receivers *receivers*} > :as options}] > ...boring java stuff) > > (defn with-context* > [options thunk] > (let [context (create-context options) > thread (create-thread context) > sources (atom {}) > receivers (atom {})] > (binding [*context* context > *thread* thread > *sources* sources > *receivers* receivers] > (try > (thunk) > (finally > ... close stuff, cleanup) > > (defmacro with-context > [options & body] > `(with-context* ~options (fn [] ~...@body))) > > Icying (not tested though, but some quick macroexpands seem to be > promising): > > (defmacro defsugaredfn > [fnname & fntail] > (let [[docstring fntail] (let [[docstring & tail :as fntail] fntail] > (if (string? docstring) > [docstring tail] > [nil fntail])) > [metamap fntail] (let [[metamap & tail :as fntail] fntail] > (if (map? metamap) > [metamap tail] > [nil fntail])) > args (first fntail) > fntail (next fntail) > options (peek args) > options (when (map? options) options) > mod-options (merge-with into > `{:keys [~'context > ~'receivers > ~'sources] > :or {~'context *context* > ~'receivers > *receivers* > ~'sources *sources*} > :as ~'options} > options) > args (if options > (pop args) > (conj args '&)) > args (conj args mod-options)] > `(defn ~fnname > ~@(concat (when docstring [docstring]) > (when metamap [metamap]) > [args]) > ~...@fntail))) > > Use as: > > (defsugaredfn init-receiver > "with docstring! yeah!" > [topic & {:keys [some] :or {some "option"}}] > ...boring java stuff) > > or > > (defsugaredfn init-receiver > [topic] > ...boring java stuff) > > context, receivers, source and options will be captured this way and > available in the "boring java stuff" part. Another downside: you have > to take care when you cross thread boundaries. Then you have to use > bound-fn or pass the context and friend explicitely. > > (with-context [:some "option"] > ... > (bound-fn [] (init-receiver "in another thread")) > ... > (fn [] (init-receiver "in another thread" :context > context :receivers receivers) > ,... > ) > > Hope that helps. > > Sincerely > Meikel > > [1]: With a macro the client code has to be recompiled. > > -- > 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
Re: question regarding macro (ab)usage
thanks for the reply, you are right! and in fact my real implementation is more like this, i thought that by showing them both as macros in the post it would be easier for people to just skim read the post and compare them side by side. probably just confused the issue, sorry. the thing im really interested to know is if binding the functions the way i have (in either example) is considered 'bad form', and if a protocol and reify is the more idiomatic solution, or if there is another solution to this problem. On Tue, Sep 28, 2010 at 2:41 AM, Nicolas Oury wrote: > I hadn't time to read the whole post, but, I I understand it well, this > snipset > > (defmacro with-context [options & body] > `(let [context# (create-context options) > thread# (create-thread context) > sources# (atom {}) > receivers# (atom {})] > (binding [init-receiver (partial init-receiver-on context# receivers#) > init-source (partial init-source-on context# sources#) > publish (partial publish-on context# sources#) > receiver (partial receive-on context# receivers#)] > (try > (do ~...@body) > (finally > ... close stuff, cleanup) > > can be written more or less: > > (defn with-context [options action] > (let [context ..]) > (binding [init-receiver .] > (try (action) (finally ))) > > That can be called with > > (with-context options #(body)) > > You can then wrap this call in a macro to remove the #(). > > I am not sure it is a good idea, but it is always good to know for > which precise feature you need the macro. > > Here tou need it to prevent to have to pass some code around as a function. > That's one frequent usage of macro, it can help readability and (very > little) performance. > But depending of the situation. you might want to trade these > advantages for composability and ease of programming. > > > Best, > > Nicolas. > > -- > 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: lein > swank > Aquamacs > slime-connect test failed. Help!
I wrote this immediately after writing the code and running the test. I should have waited a bit because in retrospect the test is bound to fail. Guessing I should have used a transaction. On Sep 28, 7:17 pm, Alex wrote: > I'm new at clojure+emacs+slime+swank+leiningen and I wanted to run a > (simple?) test that goes like this: > > $ lein new test-project; cd test-project > $ cat > ./src/core.clj > (ns test-project.core) > > (def *argh* 1) > > ; loop, printing *argh* every sec, for 100 secs > (loop [i 0] > (if (= i 100) > (println "OK.") > (do > (println *argh*) > (. Thread (sleep 1000)) > (recur (+ i 1) > > Then, to test core.clj, I ran it from the command line: > $ clj ./src/core.clj > 1 > 1 > 1 > etc. > OK. > > Then, I did: > $ lein swank > user=> Connection opened on local port 4005 > # 127.0.0.1,port=0,localport=4005]> > > First question: why no visible output? > > Still hoping, I launched emacs (actually Aquamacs, cuz I'm not that > comfortable with yanking) and: > 1. opened test-project/src/test_project/core.clj > > 2. M-x slime-connect > Versions differ: 2010-09-22 (slime) vs. 20100404 (swank). Continue? (y > or no) > > Hem. Why that? Plus, no output in the slime buffer. Just an REPL > prompt. And a non-responsive one at that (I can type but nothing that > I type is interpreted). So, just a prompt, really. > > 3. in the core.clj buffer, changed value of *arhg* to 2, placed cursor > at the end of this, and evaluated the expression (^X ^E). No change on > the slime-repl clojure side. > > I realize how little I understand about all this but would love to get > started. Any advice much appreciated. > > Thanks > Alex -- 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: examples of clojure code
Looking at the api code helped me a lot, for what it's worth. On Sep 28, 7:28 am, Timothy Washington wrote: > There is the "ANN: Clojure Cookbook" thread that Dave Sletten just posted, > where he points out a new Clojure Cookbook he's working > on:http://www.gettingclojure.com/cookbook:clojure-cookbook > > Tim > > On Tue, Sep 28, 2010 at 4:10 AM, Abraham wrote: > > Dear all , > > > any link where to find examples of clojure code used in business > > appl. , domain model , etc > > > thanks > > abraham > > > -- > > 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: Some code dramatically slower in Clojure 1.3 Alpha 1?
Hi Mark, I tested the change to expt-int. Unfortunately, still no performance gain. I'm afraid I don't have a solid enough grasp of Clojure to know what tweaks are needed to get performance fast again. Do you think you'll have time to play with 1.3 soon? On Sep 27, 1:00 am, Mark Engelberg wrote: > Thanks for the info. I'd need to research how clojure.lang.BigInt > differs from java.math.BigInteger, but I'm sure that adding the extra > case for BigInt in the multimethods wouldn't be too hard. > > I'm still stumped as to why expt and sqrt would be 100x slower. My > first thought is that the loop/recur machinery has changed in 1.3, to > support primitives in the recur, so perhaps there's some extra back > and forth boxing/unboxing going on, or perhaps loop/recur is just > fundamentally slower now? Another possibility is that all the literal > numbers are now longs instead of Integers, so maybe that's slowing > down the computations? > > I'd be curious to know whether explicitly boxing everything in the > second line of expt-int helps the performance at all (along with the ' > math operators), i.e., > > (defn- expt-int [base pow] > (loop [n pow, y (num 1), z base] > > to > > (defn- expt-int [base pow] > (loop [n (num pow), y (num 1), z (num base)] -- 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: swank-clojure-1.1.0.jar
Thanks Joost, after fighting some hours with this stack (Clojure + Swank + Slime), finally I could to put them to work together. Thanks for the tips. On Tue, Sep 28, 2010 at 2:03 PM, Joost wrote: > > > Christian Guimaraes wrote: > > Hi, > > > > the problem is the > > > > (concat "http://repo.technomancy.us/"; > > "swank-clojure-1.1.0.jar") > > > > in the swank-clojure.el > > > > this repo no longer exists. > > > > -- christian > > That's because swank-clojure.el no longer exists and is no longer > supported. swank-clojure now works "out of the box" with recent-ish > versions of slime. If you must, you'll have build and install 1.1.0 > yourself. > > But I seriously suggest you upgrade to the latest stable release > (using leiningen or maven) as documented on > http://github.com/technomancy/swank-clojure > > Also note that there is a separate swank-clojure group at > http://groups.google.com/group/swank-clojure > > -- > 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: An Emacs command to close the various balanced expressions in Clojure
Blais, Thank you for contributing the emacs code. I have been looking for the same thing, for the reasons you and Laurent PETIT described. Bill Smith Austin, Texas -- 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: swank-clojure-1.1.0.jar
On Tue, Sep 28, 2010 at 2:30 PM, Christian Guimaraes wrote: > Thanks Joost, > > after fighting some hours with this stack (Clojure + Swank + Slime), finally > I could to put them to work together. Where did you find the documentation telling you to use this method rather than M-x slime-connect? I try to make sure all the docs are up-to-date, so if it's something that can be fixed please let me know. If it's just some guy's blog, perhaps you could make a comment saying that the instructions are out of date and to look at the official readme for a better way to do it. -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: functions left over in the vm
On Sun, Sep 26, 2010 at 22:05, Robert McIntyre wrote: > > > Here are my functions that they may be helpful to you: > > (defmacro ns-nuke > ([] > (let [current-ns# (symbol (str *ns*))] > `(do > (println "NUKING namespace" (quote ~current-ns#)) > (clojure.lang.Namespace/remove (quote ~current-ns#)) > (ns ~current-ns#) > > > (defmacro reload [] > `(do > > (use :reload-all (quote ~(symbol (str *ns*)) > > > You could use remove-ns instead of cloure.lang.Namespace/remove no? Thanks for this idea, I'll keep it in mind when I next stumble over this and see if it would have helped. Cheers, mike -- 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: functions left over in the vm
On Sun, Sep 26, 2010 at 22:03, Phil Hagelberg wrote: > On Sun, Sep 26, 2010 at 2:56 PM, Michael Ossareh > wrote: > > Situation: We've built a product, very rapidly thanks to being able to > > produce stuff very quickly in clojure. However now that it is somewhat > > settled I'm in the process of paring down the code, removing defunct > fn's, > > etc. > > It's actually pretty easy to identify what defns don't get run in a > namespace with a judicious use of alter-var-root and metadata. I've > implemented this in Radagast, my simple test coverage tool: > >http://github.com/Seajure/radagast > > Funny you should mention that, I actually have a script which uses radagast and greps out the missed functions which begin with my namespace. > > Problem: You compile your code, you test it, you pare down some functions > or > > rename a function and push that into the VM - hit refresh, everything > works. > > However there is a chance you are actually using a function which you > have > > removed from the source code. i.e. you missed a reference in another file > or > > something similar. > > We call this "getting slimed". There is currently no solution for this > at least in Emacs. I would like to have a version of > slime-compile-file that would remove all vars in the namespace before > recompiling, but I haven't had the chance to implement it. > I'm happy there is a name for this!! sounds like the slime-compile-file which removes the ns prior is really what I'm looking for. > > Patches welcome, of course. > :) Ooooh if there were only time, eh ;) When I'm done with this mad dash I'll take a look. > > > Another solution I've been using is to regularly restart my running > clojure > > instance, however this has the annoyance of me losing all my locally > defined > > vars during dev. > > Restarting your VM should not be an annoyance. If you are creating > data or functions in order to test, you should create them in your > test suite. That way it's easy to run a fully-fresh run of the tests. > You don't even have to restart your swank VM; it should be totally > separate to avoid contamination. > Valid point, my test suite is woefully inadequate at the moment, a sign that dev is very rapid I'd like to think :) I'll keep this point in mind as I start to retroactively fit tests (a process I'm spending about 20% of my time on atm). BTW, Phil, thanks for all your work :) -- 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
Selecting multiple attributes using zip-filter?
Hi all - I have an xml file structured something like to retrieve the id attribute is easy enough: (zf/xml-> myxmldata :b (zf/attr :id)) but i want to retrieve both the id and name attributes into a list doing something like (zf/xml-> myxmldata :b (zf/attr [:id :name] )) Any ideas if this is possible and if so the syntax? Thanks much in advance Base -- 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: Problems Running tests with fixtures
Oh that's my mistake in the example code. My actual code does have an (is ) function. The example code should look like: (deftest test-code [] *(is (= 5 5)) * ) Tim On Tue, Sep 28, 2010 at 12:29 PM, Kevin Downey wrote: > your test has no (is ...) > > On Mon, Sep 27, 2010 at 5:16 PM, Timothy Washington > wrote: > > I suppose I've been looking at this code for too long, so I need a 2nd > pair > > of eyes on it. I'm not getting some 'test.is' code to run. I'm trying to > run > > the tests as in fig. 1. Suppose the tests are defined in a file called > > utests.clj (fig. 2). > > > > (use 'clojure.test) > > (require 'utests) > > (run-tests 'utests) > > fig. 1 - run attempts > > > > (ns utests) > > (defn test-fixture-1 [test-func] > > > > (setup-code) > > (test-func) > > (teardown-code) > > ) > > (use-fixtures :each test-fixture-1) > > (deftest test-code [] > > (= 5 5)) > > ) > > fig. 2 - utests.clj > > > > Ran 0 tests containing 0 assertions. > > 0 failures, 0 errors. > > {:type :summary, :test 0, :pass 0, :fail 0, :error 0} > > fig. 3 - output > > > > > > Q. The thing that I'm missing is... > > > > Thanks in advance > > Tim > > > > -- > > 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
Requesting my assembla membership bumped
Following the excellent instructions here: http://clojure.org/patches My assembla login is AnthonySimpson. :) -- 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: Requesting my assembla membership bumped
Oops! Damn Chrome and it's URL autocomplete! This was meant to be on clojure-dev. I'll cross-post. Sorry for the spam. :\ On Sep 28, 6:16 pm, Rayne wrote: > Following the excellent instructions here:http://clojure.org/patches > > My assembla login is AnthonySimpson. :) -- 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
Generating type hints dynamically
I'm having problems creating functions with the type hints generated dynamically. As a contrived example (my actual use case is somewhat complicated), let's say I want to make a macro that takes in as input a class symbol and returns a type hinted function that calls a method on the argument: (defmacro hinted-fn [class-sym] `(fn [~(symbol (str "^" class-sym)) arg#] (.get_val arg#))) This doesn't work, as it ends up creating a function of two arguments. Is there any way to make this work? -- 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: Generating type hints dynamically
Type hints are just metadata. Instead of emitting the type-hint from the macro, you set the :tag metadata on the relevant symbol. On Sep 28, 5:20 pm, nathanmarz wrote: > I'm having problems creating functions with the type hints generated > dynamically. > > As a contrived example (my actual use case is somewhat complicated), > let's say I want to make a macro that takes in as input a class symbol > and returns a type hinted function that calls a method on the > argument: > > (defmacro hinted-fn [class-sym] > `(fn [~(symbol (str "^" class-sym)) arg#] (.get_val arg#))) > > This doesn't work, as it ends up creating a function of two arguments. > Is there any way to make this work? -- 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: Lazytest 1.0.0 (beta)
> You note that you're using ccw, is that because you have a clue that there > could be something related to the "lazytest-ccw" combo in the issue you're > facing ? no, ccw is ok. its a big help for us die-hard eclipse users. thank you. i think its my mistake: i put tests in a different src-file but use same namespace. src in: src/main/clojure/myapp/foo.clj tests in: test/main/clojure/myapp/foo.clj clojure tries to load tests first and gets a 'symbol not found' - of course. it works ok when i use a separate ns for tests (myapp.foo-tests) and do: ; execute tests for specified namespaces (doseq [ns ["myapp.foo"]] (let [src-ns (symbol ns) test-ns (symbol (str ns "-tests"))] (println "Loading " ns) (remove-ns src-ns) (require src-ns :reload) (remove-ns test-ns) (require test-ns :reload) (println "Running tests in " test-ns) (lazytest.report.nested/report (lazytest.runner.console/run-tests test-ns remove-ns is required because tests sum up on reload as lazytest uses gensym ... have a successful day -- 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: Generating type hints dynamically
That worked great, thanks. On Sep 28, 5:42 pm, ataggart wrote: > Type hints are just metadata. Instead of emitting the type-hint from > the macro, you set the :tag metadata on the relevant symbol. > > On Sep 28, 5:20 pm, nathanmarz wrote: > > > > > I'm having problems creating functions with the type hints generated > > dynamically. > > > As a contrived example (my actual use case is somewhat complicated), > > let's say I want to make a macro that takes in as input a class symbol > > and returns a type hinted function that calls a method on the > > argument: > > > (defmacro hinted-fn [class-sym] > > `(fn [~(symbol (str "^" class-sym)) arg#] (.get_val arg#))) > > > This doesn't work, as it ends up creating a function of two arguments. > > Is there any way to make this work? -- 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
lein java opts on command line Was: New Release of the Clojure Debugging Toolkit
Baishampayan Ghose writes: >>> Why do you ask? Is there some particular functionality you are >>> interested in? >> >> Well, I'm just learning too. Currently I rely on lein swank to start >> up my JVM so that slime can connect to it. CDT seems to want you to >> manually start up the JVM with a particular set of flags. So, do you >> therefore use two JVM instances? >> >> I guess I could do with sitting and pairing for 10 mins to see how >> things work ;-) >> If you find a good solution to this please do share. >> >> Is there any chance you could record a short screencast of this stuff >> in action? > > Leiningen honours the JAVA_OPTS environment variable. If you do this - > > $ export > JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8021" > $ lein swank > > Then lein will start the JVM with the required flags. After that, > there is no reason why CDT shouldn't work. > Is there any way to pass java_opts arguments to lein on the command line? Currently I use the :jvm-opts keyword in project.clj, however it would be nice to be able to specify different argument when using different tools as mentioned in the thread above, or to be able to set different values (e.g. maximum heap sizes) depending on resources of the current computer. Is there an accepted way to handle these situations? If not would this make a good item for future lein development? Thanks -- Eric -- 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: lein java opts on command line Was: New Release of the Clojure Debugging Toolkit
On Tue, Sep 28, 2010 at 7:40 PM, Eric Schulte wrote: > Currently I use the :jvm-opts keyword in project.clj, however it would > be nice to be able to specify different argument when using different > tools as mentioned in the thread above, or to be able to set different > values (e.g. maximum heap sizes) depending on resources of the current > computer. > > Is there an accepted way to handle these situations? If not would this > make a good item for future lein development? You can use unquote to embed arbitrary evaluations in your project.clj: (defproject foo "1.0.0" :dependencies [[clojure "1.2.0"]] :jvm-opts [~(str "-Xmx" (if (= "64" (System/getProperty "sun.arch.data.model")) "2g" "1g"))]) Untested, but you get the idea. -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: New Release of the Clojure Debugging Toolkit
hmmm, you must be as big a debugger geek as I am, but I'm not sure anyone else would be interested. In any case the commands are almost trivial, which is why I don't think it will be too hard to port this to other IDE's: These are the CDT commands that were generated by the Emacs front end in the first example: (set-bp clojure.set/difference) (reval s1) (reval s2) (reval count) (reval (count s2)) (step-over) (reval (reduce disj s1 s2)) (up) (down) (cont) (line-bp "/Users/georgejahad/incoming/clo11/clojure/src/clj/clojure/ set.clj" 56) On Sep 28, 5:13 am, David Nolen wrote: > On Tue, Sep 28, 2010 at 3:40 AM, George Jahad > wrote: > > > As some of you know, I suffer from a seemingly interminable obsession > > with improving the Clojure debugging story. It just seems so clear to > > me that Clojure deserves a world class debugger, one befitting it's > > power, beauty and elegance. Maybe one day, we'll get there. Till > > then, here are my latest improvements to the CDT: > > Great stuff! Would it be possible to write a version of the tutorial that > shows how to accomplish the same things purely from the command line? While > I love Emacs as much as the next guy, I think a tutorial that shows how to > debug using only the CDT REPL would be useful to many people. > > David -- 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: New Release of the Clojure Debugging Toolkit
I forgot to make clear in my post that port 8021 is just an example, you should use another if that one is in use, and you get this error: [null] ERROR: transport error 202: bind failed: Address already in use [null] ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) Adie mentioned that you don't need to specify a port at all: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n" java will pick one for you and display it on stdout, and you can use that as the parameter to cdt. Also, Sam, my previous post seems to have gotten eaten, but I'll work on that screencast. -- 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: functions left over in the vm
On Tue, Sep 28, 2010 at 3:15 PM, Michael Ossareh wrote: >> http://github.com/Seajure/radagast > > Funny you should mention that, I actually have a script which uses radagast > and greps out the missed functions which begin with my namespace. There's some customization built-in to Radagast (the :radagast/ns-whitelist key in project.clj) that allows you to whitelist Clojure namespaces. You could add in something that would work the opposite; checking the namespace against a regex before it bothers to instrument it for coverage. -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: lein > swank > Aquamacs > slime-connect test failed. Help!
On Tue, Sep 28, 2010 at 4:17 AM, Alex wrote: > Then, I did: > $ lein swank > user=> Connection opened on local port 4005 > # 127.0.0.1,port=0,localport=4005]> > > First question: why no visible output? Running "lein swank" just launches a swank server. It doesn't run any of your project's code. Once you connect via slime, you can use C-c C-k to compile a given namespace. But generally it's poor form to have side-effects in the top-level; you should wrap your code in a defn and run that function at the repl. > Still hoping, I launched emacs (actually Aquamacs, cuz I'm not that > comfortable with yanking) and: > 1. opened test-project/src/test_project/core.clj This may work, but Aquamacs is not officially supported since it's not portable; I can't run it on my machine to test. Some people use it OK, but GNU Emacs has much better compatibility. > 2. M-x slime-connect > Versions differ: 2010-09-22 (slime) vs. 20100404 (swank). Continue? (y > or no) > > Hem. Why that? That's a bug in the packaging of SLIME. -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