Re: copying structures
> The def was for legibility (or I was going for legibility). Speaking > of redefing, is there a way to block a redef so I or someone else > doesn't monkey-patch a function? You can set a validator on the Var to prevent accidents. However, someone who really wants to redefine a function can just disable the validator first :/ -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
unmapping all namespaces in repl
Hi, How can I easily unmap all namespaces in a repl or swank? (so I can continue working as if I have just started up the REPL, no matter what I've "use"-d previously) Istvan -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: unmapping all namespaces in repl
On Tue, Mar 30, 2010 at 10:36 AM, Istvan Devai wrote: > Hi, > > How can I easily unmap all namespaces in a repl or swank? (so I can continue > working as if I have just started up the REPL, no matter what I've "use"-d > previously) > > Istvan I posted a bit of a lengthy exposition on this topic last year after experimenting with modifying namespaces. Perhaps that will give you some ideas. See below... >On Sun, Aug 30, 2009 at 8:46 AM, Adrian Cuthbertson > wrote: >> Is there a way to unregister some names from a namespace without reloading >> it ? > > This is a bit trickier than one might think. An example illustrates this; > > Given two files, a.clj... > (ns a) > (defn stuff-a [] :stuff-a) > (defn hello [] :hello) > > And b.clj... > (ns b) > (defn stuff-b [] :stuff-b) > > Say we have an ns 'x which is our running ns which uses 'a and 'b and > we wish to move the 'hello function into 'b in the files and then > dynamically reload so that 'x now has the correct mapping to 'hello > (i.e in 'b) > > So in the Repl we'll create an empty ns 'x and change to it... > user=>(create-ns 'x) > # > user=> (in-ns 'x) > # > > And load the two files with clojure.core/use ('x does not refer to > clojure.core so we can see all the ns mapping more clearly)... > x=> (clojure.core/use 'a) > nil > x=> (clojure.core/use 'b) > ni > > So, 'x now sees... > (clojure.core/ns-refers 'x) > {hello #'a/hello, stuff-a #'a/stuff-a, stuff-b #'b/stuff-b} > > And 'a and 'b contain... > x=> (clojure.core/ns-publics 'a) > {hello #'a/hello, stuff-a #'a/stuff-a} > x=> (clojure.core/ns-publics 'b) > {stuff-b #'b/stuff-b} > > You've probably guessed it by now - to move 'hello from 'a to 'b we have to; > 1.) Move it from file a.clj to b.clj > 2.) Re-require and reload 'b > 3.) Unmap it in the "refers" of 'x > 4.) Re-refer 'b so 'x now sees it in 'b > 5.) Unmap it in the "publics" of 'a > > Here's the "dynamic reload" after 1.)... > 2.) Reload 'b... > (clojure.core/require 'b :reload) > nil > x=> (clojure.core/ns-publics 'b) > {hello #'b/hello, stuff-b #'b/stuff-b} > x=> (clojure.core/ns-publics 'a) > {hello #'a/hello, stuff-a #'a/stuff-a} > Note that both 'a and 'b now have 'hello loaded but that's ok as 'x > still only knows about the version in 'a. > > 3, 4 and 5.)... > x=> (clojure.core/ns-unmap 'x 'hello) > nil > x=> (clojure.core/refer 'b) > nil > x=> (clojure.core/ns-unmap 'a 'hello) > nil > > And so finally we have... > (clojure.core/ns-publics 'a) > {stuff-a #'a/stuff-a} > x=> (clojure.core/ns-publics 'b) > {hello #'b/hello, stuff-b #'b/stuff-b} > x=> (clojure.core/ns-publics 'x) > {} > x=> (clojure.core/ns-refers 'x) > {hello #'b/hello, stuff-a #'a/stuff-a, stuff-b #'b/stuff-b} > > There still is a problem with this technique - 3.) and 4.) are not > atomic, so if 'hello is called between those two steps (which is > likely in a busy web server), that invocation will fail. Note that the > (ns-remove technique has the same problem, but at a coarser grain > level). > > I think it's worth looking at encapsulating this whole reload > procedure into a properly atomically protected transaction as it will > be very useful in many server scenarios. This would probably require > changes to the namespace functions in core. Any thoughts? -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Getting started with open source Clojure projects
If this is a dumb question, let me apologize in advance. The thing is, I've been trying to learn Clojure in my spare time, and, following the advice of several Clojure blogs, started by reading Halloway's book and playing around a bit at the REPL, which is all well and good, but now I'm ready to tackle something a little bigger. The project that interests me most is James Reeve's Compojure, so I cloned the repository with the intention of loading the source files into the REPL and testing out some of the functions to get an idea of how it works internally. The first hurdle was getting all the dependent classes on the classpath, which I did by adding them one by one to the .clojure file (I'm using a script that concatenates the contents of .clojure to the classpath before launching the REPL). So far, so good. However, when I try to load core.clj from the REPL, it complains about not being able to find "compojure/response.clj" or its equivalent class. And it does this even if I load response.clj first, then try to load core.clj. So here are my questions: Am I going about this the wrong way? Is there an easier way to explore existing open-source projects? I Is there a less cumbersome way to get a load of files on the classpath than manually editing the .clojure file? How do I tell the REPL where to find response.clj so that core.clj will load? Any other advice will be much appreciated as well. Thanks, Daniel -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Getting started with open source Clojure projects
On Mon, Mar 29, 2010 at 11:39 PM, Daniel wrote: > Is there a less cumbersome way to get a load of files on the classpath > than manually editing the .clojure file? Well, I have a ~/lib/clojure directory and a clj script that automatically puts that directory and all .jar's in it on the classpath. Linux version: #!/bin/bash : "${CLOJURE_LIB:=${HOME}/lib/clojure}" export CLASSPATH="${CLASSPATH:+$CLASSPATH:}$HOME/lib/java/clojure.jar:$CLOJURE_LIB" if [ -d "$CLOJURE_LIB" ]; then for f in "$CLOJURE_LIB"/*.jar; do if [ -r "$f" ]; then CLASSPATH="$CLASSPATH:$f" fi done fi rlwrap java clojure.main "$@" The actual java invocation can of course be replaced to e.g. use JLine instead of rlwrap; I use the latter because JLine doesn't seem to have a vi mode. (Yes, I know, vi user in a Lispy language - heretical!) -- Mark J. Reed -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: intuitive stack trace
On Mar 29, 2:23 pm, strattonbrazil wrote: > I do something wrong, I have to read through the stack which sometimes > just says there's an error at line 0, which doesn't help me much. One problem is that the compiler can't keep track of line numbers in the REPL (or SLIME). If you load your code from a file you should at least get line numbers back. -SS -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: unmapping all namespaces in repl
On Mar 30, 4:36 am, Istvan Devai wrote: > How can I easily unmap all namespaces in a repl or swank? The following will give you a fresh "user" namespace: (in-ns 'clojure.core) (remove-ns 'user) (ns user) -SS -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Getting started with open source Clojure projects
Daniel writes: > Am I going about this the wrong way? Is there an easier way to explore > existing open-source projects? I Try this for any leiningen project (check for the existence of a project.clj file). I'm assuming you're using a unixy operating system. First and once-off, install leiningen: wget http://github.com/technomancy/leiningen/raw/stable/bin/lein chmod a+x lein ./lein self-install Clone target project (in this case Compojure): git clone git://github.com/weavejester/compojure.git cd compojure Ask Lein to download Compojure's dependencies (this includes Clojure, you don't need to it install it manually): ../lein deps Fire up a repl: ../lein repl Clojure 1.1.0 user=> (use 'compojure.core) nil Alternatively if you're using Java 6 you can start the REPL without any wrapper script pretty easily. I prefer to do it this way as it makes it obvious what the classpath is and allows tweaking the JVM options (for example increasing the memory limit with -Xmx256m). java -cp 'lib/*:classes:src' clojure.main Clojure 1.1.0 user=> (use 'compojure.core) nil > Is there a less cumbersome way to get a load of files on the classpath > than manually editing the .clojure file? Note the wildcard 'lib/*' notation I used above. This was added in Java 6. Be aware that it has to be some/directory/* not *.jar, foo* or any other variation. Put it in single quotes to make sure your shell doesn't try and expand it. It'll add any jar files found in the directory to the classpath. Hope that helps. 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
RE: Getting started with open source Clojure projects
> So here are my questions: > > Am I going about this the wrong way? Is there an easier way > to explore existing open-source projects? I Is there a less > cumbersome way to get a load of files on the classpath than > manually editing the .clojure file? How do I tell the REPL > where to find response.clj so that core.clj will load? For Compojure I think you need also Ring: http://github.com/mmcgrana/ring (also a mailing list here: http://groups.google.com/group/ring-clojure) There's been a lot of activity there recently, various projects refactoring in terms of each other, and that seems to be where they're ending up. I don't know too much about it, but I did run through the code and examples just yesterday. The other thing is: leiningen. http://github.com/technomancy/leiningen A lot of projects are using it, and it's dead simple dependency management. Download the project, look for the project.clj file, run 'lein deps' in that directory, and you get all needed dependency jars loaded into a 'lib' subdirectory. cheers, Kevin Kelley -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Getting started with open source Clojure projects
Take a look at the dependency management tools. Most open-source Clojure projects use either Maven and Leiningen. Both use the same dependency model and provide similar capabilities for starting a REPL with the classpath configured automatically. -SS On Mar 29, 11:39 pm, Daniel wrote: > If this is a dumb question, let me apologize in advance. The thing is, > I've been trying to learn Clojure in my spare time, and, following the > advice of several Clojure blogs, started by reading Halloway's book > and playing around a bit at the REPL, which is all well and good, but > now I'm ready to tackle something a little bigger. The project that > interests me most is James Reeve's Compojure, so I cloned the > repository with the intention of loading the source files into the > REPL and testing out some of the functions to get an idea of how it > works internally. The first hurdle was getting all the dependent > classes on the classpath, which I did by adding them one by one to > the .clojure file (I'm using a script that concatenates the contents > of .clojure to the classpath before launching the REPL). So far, so > good. However, when I try to load core.clj from the REPL, it complains > about not being able to find "compojure/response.clj" or its > equivalent class. And it does this even if I load response.clj first, > then try to load core.clj. > > So here are my questions: > > Am I going about this the wrong way? Is there an easier way to explore > existing open-source projects? I > Is there a less cumbersome way to get a load of files on the classpath > than manually editing the .clojure file? > How do I tell the REPL where to find response.clj so that core.clj > will load? > > Any other advice will be much appreciated as well. > > Thanks, > > Daniel -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
regular expression sequence
I am having trouble with the re-seq regular expression form. I am not an expert on regex, so this is probably part of my problem. I have a k12 text file, basically it is hex broken up by '|' . I would like to grab all the hex between two hex numbers (sample text below). For example, I might want all of the text between 49|00 and a4|ff I wrote the following regex to do this: (re-seq #"49[0-9a-f|]+|a4|ff|+" slurped) This didn't work and gave me an exception about the + sign being a dangling meta character, So, I rewrote it with the expression placed in parenthesis: (re-seq #"(18[0-9a-f|]+|b6|a5|)+" slurped) Now, this works, but is kind of funky b/c it a lot of the sequences I get are empty. It looks kind of like this (["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["49|00|47|00|2f|00|60|ff|5f|ff|41|ff| 1e|ff|78|ff|35|00|ea|ff|d2|ff|bd|ff|69|00|7e|00|8e|00|5e|00|c2|00|7d| 00|b1|ff|5f|00|be|00|20|00|c9|ff|b5|ff|86|ff|66|00|9b|00|25|00|73|ff| b0|ff|94|ff|e3|ff|8d|00|7a|00|90|ff|70|ff|8a|ff|b1|ff|51|00|a0|ff|b5| ff|91|ff|c6|ff|07|00|c9|ff|b4|ff|9e|ff|be|ff|cd|ff|a6|00|23|01|21|01| a4|00|3d|00|22|00|ab|ff|af|ff|8e|ff|43|ff|51|ff|6b|ff|b6|ff|bf|ff|a4| ff|27|00|84|00|7c|00|82|00|9f|00|5a|00|34|00|27|00|6c|00|77|00|41|00| c0|ff|c6|ff|ad|ff|bd|ff|7c|00|3a|00|90|ff|b8|ff|48|ff|99|00|69|00|48| 00|27|00|7e|ff|83|ff|ca|ff|bf|ff|d9|ff|72|ff|87|ff|c2|ff|c1|ff|b9|ff| e1|ff|94|ff|c7|ff|e4|ff|c7|00|ca|00|be|00|99|00|37|00|c7|ff|d7|ff|36| 00|43|ff|62|ff|2c|ff|73|ff|a4" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""] ["" ""]) Sample k12 hex: +-+---+--+ 01:30:28,579,598 ETHER |a5|a5|a5|a5|a5|a5|a5|a5|a5|a5|a5|a5| +-+---+--+ 01:30:28,646,595 ETHER |b0|ff|db|ff|c1|ff|f2|ff|13|00|57|00|a9|00|d3|00|f3|00|9f|00|49|00|47| 00|2f|00|60|ff|5f|ff|41|ff|1e|ff|78|ff|35|00|ea|ff|d2|ff|bd|ff|69|00| 7e|00|8e|00|5e|00|c2|00|7d|00|b1|ff|5f|00|be|00|20|00|c9|ff|b5|ff|86| ff|66|00|9b|00|25|00|73|ff|b0|ff|94|ff|e3|ff|8d|00|7a|00|90|ff|70|ff| 8a|ff|b1|ff|51|00|a0|ff|b5|ff|91|ff|c6|ff|07|00|c9|ff|b4|ff|9e|ff|be| ff|cd|ff|a6|00|23|01|21|01|a4|00|3d|00|22|00|ab|ff|af|ff|8e|ff|43|ff| 51|ff|6b|ff|b6|ff|bf|ff|a4|ff|27|00|84|00|7c|00|82|00|9f|00|5a|00|34| 00|27|00|6c|00|77|00|41|00|c0|ff|c6|ff|ad|ff|bd|ff|7c|00|3a|00|90|ff| b8|ff|48|ff|99|00|69|00|48|00|27|00|7e|ff|83|ff|ca|ff|bf|ff|d9|ff|72| ff|87|ff|c2|ff|c1|ff|b9|ff|e1|ff|94|ff|c7|ff|e4|ff|c7|00|ca|00|be|00| 99|00|37|00|c7|ff|d7|ff|36|00|43|ff|62|ff|2c|ff|73|ff|a4|ff|32| +-+---+--+ 01:30:28,669,317 ETHER |a5|a5|a5|a5|a5|a5|a5|a5|a5|a5|a5|a5| +-+---+--+ -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Getting started with open source Clojure projects
Hi, On Mar 30, 3:45 pm, Stuart Sierra wrote: > Take a look at the dependency management tools. Most open-source > Clojure projects use either Maven and Leiningen. Both use the same > dependency model and provide similar capabilities for starting a REPL > with the classpath configured automatically. There are also gradle and ant combined with Ivy as possible helpers. They also build on the maven repositories. So they should work fine, too. 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
Hi, you have to escape the |. user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| ee|d3"]) However this will be greedy... 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
ANN: clj-tagsoup
Hi all, I would like to announce clj-tagsoup, a simple cl-html-parse workalike for Clojure. A quick example: (parse "http://example.com";) => [:html {} [:head {} [:title {} "Example Web Page"]] [:body {} [:p {} "You have reached this web page by typing \"example.com\",\n\"example.net\",\n or \"example.org\" into your web browser."] [:p {} "These domain names are reserved for use in documentation and are not available \n for registration. See " [:a {:shape "rect", :href "http://www.rfc- editor.org/rfc/rfc2606.txt"} "RFC \n 2606"] ", Section 3."]]] The code is on http://github.com/nathell/clj-tagsoup. I've pushed it to Clojars, too. Best regards, Daniel Janus -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Remapping Class Imports
Hi, Is it possible to remap the name of a class or package import? Ideally I'd like to say something like (import [[java.util :as ju] ArrayList List]) and then use (ju.ArrayList.) to refer to the class. I recall reading Rich doesn't like auto-imports of all classes in a package or of renaming class. But what about this? I don't like the choice between importing a class and using its unqualified name or having to use a fully qualified name. Its also problematic when you work with libraries where two classes have the same name (e.g Parser). Does anyone have macros to handle this? Thanks, Aria -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
The result is a little bit strange still, since I am getting dupliates. First, it returns the string I want 49|00|12 12|a9|a4|ff but then it also returns the same string without the first and last 4 characters, e.g. 12|12|a9| Also, how come I don't need to escape the | inside the parenthesis? thanks Meikel!! On Mar 30, 10:59 am, Meikel Brandmeyer wrote: > Hi, > > you have to escape the |. > > user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| > fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") > (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| > ee|d3"]) > > However this will be greedy... > > 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
Parentheses capture - anything that matches a parenthesized portion of a regular expression is returned as part of the result of the match: user=> (re-seq #"a(.)c" "abc") (["abc" "b"]) If you don't want that behavior, you can use the special non-capturing syntax, (?:...): user=> (re-seq #"a(?:.)c" "abc") ("abc") You don't have to escape pipes or any other special characters inside a character class (that is, between [...]), because characters lose their special meanings there: [.*] matches either a period or an asterisk and has no relationship to the "any character" symbol or "zero or more" repetition operator. The only special things inside a character class are a leading '^', which negates the class, and a '-' in the middle, which makes a range: [^a-z] matches any single character that is not a lowercase letter (of the English alphabet). Position matters: [-^] matches a literal hyphen or caret, and [] is not an empty character class but a syntax error (an unclosed character class that so far includes a literal ']' character). On Tue, Mar 30, 2010 at 12:37 PM, Glen Rubin wrote: > The result is a little bit strange still, since I am getting > dupliates. First, it returns the string I want > > 49|00|12 12|a9|a4|ff > > but then it also returns the same string without the first and last 4 > characters, e.g. > > 12|12|a9| > > Also, how come I don't need to escape the | inside the parenthesis? > > thanks Meikel!! > > > On Mar 30, 10:59 am, Meikel Brandmeyer wrote: >> Hi, >> >> you have to escape the |. >> >> user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| >> fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") >> (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| >> ee|d3"]) >> >> However this will be greedy... >> >> 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 > > To unsubscribe from this group, send email to > clojure+unsubscribegooglegroups.com or reply to this email with the words > "REMOVE ME" as the subject. > -- Mark J. Reed -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
Addendum: I highly recommend Jeffrey Friedl's book _Mastering_Regular_Expressions_ if you want to learn how to use regexes well. There are also a number of introductions/tutorials online, but I'm not familiar enough with them to recommend any. On Tue, Mar 30, 2010 at 12:50 PM, Mark J. Reed wrote: > Parentheses capture - anything that matches a parenthesized portion of > a regular expression is returned as part of the result of the match: > > user=> (re-seq #"a(.)c" "abc") > (["abc" "b"]) > > If you don't want that behavior, you can use the special non-capturing > syntax, (?:...): > > user=> (re-seq #"a(?:.)c" "abc") > ("abc") > > You don't have to escape pipes or any other special characters inside > a character class (that is, between [...]), because characters lose > their special meanings there: [.*] matches either a period or an > asterisk and has no relationship to the "any character" symbol or > "zero or more" repetition operator. > > The only special things inside a character class are a leading '^', > which negates the class, and a '-' in the middle, which makes a range: > [^a-z] matches any single character that is not a lowercase letter (of > the English alphabet). Position matters: [-^] matches a literal > hyphen or caret, and [] is not an empty character class but a syntax > error (an unclosed character class that so far includes a literal ']' > character). > > > On Tue, Mar 30, 2010 at 12:37 PM, Glen Rubin wrote: >> The result is a little bit strange still, since I am getting >> dupliates. First, it returns the string I want >> >> 49|00|12 12|a9|a4|ff >> >> but then it also returns the same string without the first and last 4 >> characters, e.g. >> >> 12|12|a9| >> >> Also, how come I don't need to escape the | inside the parenthesis? >> >> thanks Meikel!! >> >> >> On Mar 30, 10:59 am, Meikel Brandmeyer wrote: >>> Hi, >>> >>> you have to escape the |. >>> >>> user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| >>> fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") >>> (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| >>> ee|d3"]) >>> >>> However this will be greedy... >>> >>> 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 >> >> To unsubscribe from this group, send email to >> clojure+unsubscribegooglegroups.com or reply to this email with the words >> "REMOVE ME" as the subject. >> > > > > -- > Mark J. Reed > -- Mark J. Reed -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
towards definitive "getting started" assistance
The labrepl now has much better "getting started" instructions, thanks to everyone who pitched in. But this begs the question: Why hide the getting started instructions in a single project? So, I am working to create definitive instructions for getting started with Clojure in a variety of environments. The goal: A single source of truth that stays up to date. The plan: (1) Keep the instructions linked from a page in Assembla (http://www.assembla.com/wiki/show/clojure/Getting_Started ). Assembla rather than clojure.org to help with maintenance, since all CA signers can get on Assembla and pitch in. (2) Link to the Assembla page from clojure.org (tbd soon). What I (Stu) will commit to do: (1) Edit and post new suggestions from the community. (2) Review and test *some* of the suggestions. (3) Flip the official bit (link from clojure.org) once y'all are happy. Requested of you, the community: (1) If you created, or are the expert on, some environment, please feel free to either update the Assembla page directly, or send edits to me. (2) If you find a problem let me know. (3) If you write or have written a blog post or article on setup particulars, also link out to the Assembla page. (4) Help me by reviewing and testing instructions. Suggestions and comments welcome, as always. Thanks! Stu -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
RFC: Improvements in Clojure error message "No matching ctor for ..."
I think Clojure should provide more information when certain error conditions occur. Example: (when-not (= (Integer. (:userid json)) (Integer. (:userid a-user))) NOTE: (:userid a-user) is always some sort of number. (:userid json) is always a String. After testing (Integer. (:userid a-user)) _sometimes_ fails with: java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer In this specific case you might argue that I don't know how to compare two numbers in clojure. And that might be true:-) In any case, I would find it _really_ helpful to have the (class) of the arg that failed. I think that this is something that generally all people using Clojure would be thankful for at one time or another. In this case, having the (class) would tell me that the failed arg was java.lang.Long. I'd then know immediately the reason for the problem and the solution. Any reason why this does _not_ make sense? -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: towards definitive "getting started" assistance
Hi, I wrote an blog post on how to use clojure in gradle. That may be of use as part of the "getting started" http://m.3wa.com/?p=464 Thanks, On Tue, Mar 30, 2010 at 1:12 PM, Stuart Halloway wrote: > The labrepl now has much better "getting started" instructions, thanks to > everyone who pitched in. But this begs the question: Why hide the getting > started instructions in a single project? So, I am working to create > definitive instructions for getting started with Clojure in a variety of > environments. > > The goal: > A single source of truth that stays up to date. > > The plan: > (1) Keep the instructions linked from a page in Assembla > (http://www.assembla.com/wiki/show/clojure/Getting_Started). Assembla rather > than clojure.org to help with maintenance, since all CA signers can get on > Assembla and pitch in. > (2) Link to the Assembla page from clojure.org (tbd soon). > > What I (Stu) will commit to do: > (1) Edit and post new suggestions from the community. > (2) Review and test *some* of the suggestions. > (3) Flip the official bit (link from clojure.org) once y'all are happy. > > Requested of you, the community: > (1) If you created, or are the expert on, some environment, please feel free > to either update the Assembla page directly, or send edits to me. > (2) If you find a problem let me know. > (3) If you write or have written a blog post or article on setup > particulars, also link out to the Assembla page. > (4) Help me by reviewing and testing instructions. > > Suggestions and comments welcome, as always. > > Thanks! > Stu > > -- > 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 > > To unsubscribe from this group, send email to > clojure+unsubscribegooglegroups.com or reply to this email with the words > "REMOVE ME" as the subject. > -- Omnem crede diem tibi diluxisse supremum. -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
thx that works great! i guess I can also just leave out the parenthesis all together. but, what if i wanted just the portion inside?? the duplicate I wanted to get rid of? also any way to return the sequence without all those bars or do i have to use a seperate regex and or filter? On Mar 30, 12:52 pm, "Mark J. Reed" wrote: > Addendum: I highly recommend Jeffrey Friedl's book > _Mastering_Regular_Expressions_ if you want to learn how to use > regexes well. There are also a number of introductions/tutorials > online, but I'm not familiar enough with them to recommend any. > > On Tue, Mar 30, 2010 at 12:50 PM, Mark J. Reed wrote: > > > > > > > Parentheses capture - anything that matches a parenthesized portion of > > a regular expression is returned as part of the result of the match: > > > user=> (re-seq #"a(.)c" "abc") > > (["abc" "b"]) > > > If you don't want that behavior, you can use the special non-capturing > > syntax, (?:...): > > > user=> (re-seq #"a(?:.)c" "abc") > > ("abc") > > > You don't have to escape pipes or any other special characters inside > > a character class (that is, between [...]), because characters lose > > their special meanings there: [.*] matches either a period or an > > asterisk and has no relationship to the "any character" symbol or > > "zero or more" repetition operator. > > > The only special things inside a character class are a leading '^', > > which negates the class, and a '-' in the middle, which makes a range: > > [^a-z] matches any single character that is not a lowercase letter (of > > the English alphabet). Position matters: [-^] matches a literal > > hyphen or caret, and [] is not an empty character class but a syntax > > error (an unclosed character class that so far includes a literal ']' > > character). > > > On Tue, Mar 30, 2010 at 12:37 PM, Glen Rubin wrote: > >> The result is a little bit strange still, since I am getting > >> dupliates. First, it returns the string I want > > >> 49|00|12 12|a9|a4|ff > > >> but then it also returns the same string without the first and last 4 > >> characters, e.g. > > >> 12|12|a9| > > >> Also, how come I don't need to escape the | inside the parenthesis? > > >> thanks Meikel!! > > >> On Mar 30, 10:59 am, Meikel Brandmeyer wrote: > >>> Hi, > > >>> you have to escape the |. > > >>> user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| > >>> fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") > >>> (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| > >>> ee|d3"]) > > >>> However this will be greedy... > > >>> 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 > > >> To unsubscribe from this group, send email to > >> clojure+unsubscribegooglegroups.com or reply to this email with the words > >> "REMOVE ME" as the subject. > > > -- > > Mark J. Reed > > -- > Mark J. Reed -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: regular expression sequence
Leaving out the parentheses changes the meaning because they group as well as capture. #"a(b|c)d" matches either "abd" or "acd". #"ab|cd" matches either "ab" or "cd". On Tuesday, March 30, 2010, Glen Rubin wrote: > thx that works great! i guess I can also just leave out the > parenthesis all together. > > but, what if i wanted just the portion inside?? the duplicate I > wanted to get rid of? > > also any way to return the sequence without all those bars or do i > have to use a seperate regex and or filter? > > On Mar 30, 12:52 pm, "Mark J. Reed" wrote: >> Addendum: I highly recommend Jeffrey Friedl's book >> _Mastering_Regular_Expressions_ if you want to learn how to use >> regexes well. There are also a number of introductions/tutorials >> online, but I'm not familiar enough with them to recommend any. >> >> On Tue, Mar 30, 2010 at 12:50 PM, Mark J. Reed wrote: >> >> >> >> >> >> > Parentheses capture - anything that matches a parenthesized portion of >> > a regular expression is returned as part of the result of the match: >> >> > user=> (re-seq #"a(.)c" "abc") >> > (["abc" "b"]) >> >> > If you don't want that behavior, you can use the special non-capturing >> > syntax, (?:...): >> >> > user=> (re-seq #"a(?:.)c" "abc") >> > ("abc") >> >> > You don't have to escape pipes or any other special characters inside >> > a character class (that is, between [...]), because characters lose >> > their special meanings there: [.*] matches either a period or an >> > asterisk and has no relationship to the "any character" symbol or >> > "zero or more" repetition operator. >> >> > The only special things inside a character class are a leading '^', >> > which negates the class, and a '-' in the middle, which makes a range: >> > [^a-z] matches any single character that is not a lowercase letter (of >> > the English alphabet). Position matters: [-^] matches a literal >> > hyphen or caret, and [] is not an empty character class but a syntax >> > error (an unclosed character class that so far includes a literal ']' >> > character). >> >> > On Tue, Mar 30, 2010 at 12:37 PM, Glen Rubin wrote: >> >> The result is a little bit strange still, since I am getting >> >> dupliates. First, it returns the string I want >> >> >> 49|00|12 12|a9|a4|ff >> >> >> but then it also returns the same string without the first and last 4 >> >> characters, e.g. >> >> >> 12|12|a9| >> >> >> Also, how come I don't need to escape the | inside the parenthesis? >> >> >> thanks Meikel!! >> >> >> On Mar 30, 10:59 am, Meikel Brandmeyer wrote: >> >>> Hi, >> >> >>> you have to escape the |. >> >> >>> user=> (re-seq #"49\|00\|([0-9a-f|]+)\|a4\|ff" "a5|a5|49|23|49|00|12| >> >>> fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff|ae") >> >>> (["49|00|12|fc|5e|a4|ff|a7|49|00|ee|d3|a4|ff" "12|fc|5e|a4|ff|a7|49|00| >> >>> ee|d3"]) >> >> >>> However this will be greedy... >> >> >>> 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 >> >> >> To unsubscribe from this group, send email to >> >> clojure+unsubscribegooglegroups.com or reply to this email with the words >> >> "REMOVE ME" as the subject. >> >> > -- >> > Mark J. Reed >> >> -- >> Mark J. Reed > > -- > 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 > > To unsubscribe from this group, send email to > clojure+unsubscribegooglegroups.com or reply to this email with the words > "REMOVE ME" as the subject. > -- Mark J. Reed -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: towards definitive "getting started" assistance
Just a thought. Would it be more effective to create a GitHub page for this? Assembla is cool for ticketing but it's kinda ugly and unfriendly. For example I think something like this: http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html is much friendlier and the kind of base-level design aesthetic people expect from programming language introductions these days. I'm more than happy to submit content, sadly my design chops are abysmal. /me wishes someone would put together a http://tryclojure.org. 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Leiningen, Clojure and libraries: what am I missing?
Thanks, that was insightful. To recap, subclassloader is a optimization to reduce the startup time of launching a new clojure instance from leiningen. In addition, I learned that computing the classpath was conducted in clojure code. I see now that the bash script is just a bootstrapping tool to get an instance of clojure running. This means that we have the full power of clojure at our disposal to compute the desired classpath. Many people make the more complex compute classpath feature request but may not realize the reasonable tractability of writing such a plugin. On another note, I'm currently concerned with utilizing a global configuration of leiningen (e.g. installing plugins and define additional repositories globally). My current idea is to create a git fork/branch to manage personal configuration files within the checkout folder and then implement a bootstrapping script to facilitate automating the deployment of alternative branches of leiningen. Brent Alex Osborne wrote: > Brent Millare writes: > > > Can someone please elaborate on this subclassloader process? Although > > the design for leiningen is architecturally simple and understandable > > and thus easy to extend, I'm still quite unfamiliar with the "java > > way". I believe a little documentation on this aspect can make a > > significant improvement in allowing contributions to leiningen. > > Given I implemented the initial support for it, I'll give it a go. In > earlier versions of Leiningen you weren't able to compile code against a > different version of Clojure to the one that Lein was running on top > of, as you could only have one or the other in the classpath. One way to > get around this is to fork off a new java process and run the compile in > a separate JVM. Unfortunately we'd then be incurring the JVM's startup > overhead twice (and lein is already annoyingly slow to start). Wouldn't > it be nice if we could just run the compile in the original JVM but > isolated in a container somehow? > > Well we can actually do this because the JVM supports custom > classloaders. A classloader is an object that when given a classname, > locates the appropriate class files (in jars, classpath etc) and loads it > into memory. There's a default builtin classloader which searches the > classpath you supply on the command-line. Custom classloaders can be > used for a number of things, for example loading jars over the network > or out of a new archive format. They also play a strong role in the > JVM's security module (for sandboxing etc). When a class is loaded > (manually) into a custom classloader, any classes it in turn > tries to load (by normal means) are also loaded via that same > classloader. > > So basically what Lein does is creates a new classloader (it actually > reuses Apache Ant's implementation) with a different classpath which > points to the version of clojure and other libraries that you want to > compile against. > > Take a look at the eval-in-project function in leiningen/compile.clj. > You pass in a form to be evaluated as an argument. It's converted to a > string and then clojure.main is invoked with the '-e' argument to > evaluate the string 'inside' the new classloader. The reason its done > this way is so that its easy to fall back to forking and also because > objects in the new classloader aren't compatible with those in the > original (as they're potentially different versions of Clojure). > > You can see that it doesn't work perfectly for all cases, so for example > if you're using native libs or OS X it'll fork instead. (OS X injects > some GUI stuff into the classpath of all the apps it runs, so anything > using using Swing or AWT doesn't work properly in the new classloader). > > You may have wondered how Java servlet containers like Jetty and Tomcat > are able to load different versions of the same class into the same JVM > without them conflicting. As I understand it they use basically the > same mechanism. > > Hope that helps. If you're having trouble following the classloader > stuff just think of the eval-in-project function as starting a new > "virtual" JVM with a different classpath and evaling some code in it. > Its really not all that complex, its just the terminology makes it sound > somewhat arcane. > > 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
labrepl issues & feedback from the Dundee Clojure Dojo
Hi all, Today we hosted the second weekly Clojure workshop at my office in Dundee, Scotland. Prior to the event I thought we'd use labrepl as a convenient way to deliver some simple tutorial/exercises along with a working Clojure environment. The event was reasonably successful but there were some inevitable installation issues with Clojure and labrepl. We had one Emacs guy choose to use a command line install via leiningen. With a helping hand from me, we got him up and running within a few minutes, with few problems... The only problem he encountered (and why I stepped in) was when he struggled a little to figure out how to install leiningen. lein's install is easy, though punting to the lein documentation for the leiningen install process makes it somewhat awkward to find the install link. This could be fixed by simply including a link to the lieningen install script from the labrepl page itself; just like is done for Enclojure. This environment proved the most painless to setup, though he lacked Emacs & Editor integration The reason he opted for the Command Line install was because I urged him to avoid setting up Emacs just now (as it can be a slippery slope... especially when dealing with someone who already had an extensive set of Emacs customisations). I figure he'll work this out himself in his own time. The remaining two users, opted for Netbeans + Enclojure, as judging by the labrepl docs this seemed to be the easiest. The first guy had some problems with his initial installation. Firstly nbgit threw an error about authentication when trying to clone the git repo. This same error was encountered by everyone running Netbeans, including myself when I tried it out yesterday. Fortunately the guy who was running this under OS X had already got git installed, so he managed to clone labrepl with git, and point netbeans at the labrepl directory... Unfortunately here he encountered another issue I also encountered, which is that some versions of Netbeans don't seem to ship with maven support built in, meaning it's not possible to open the labrepl project under Netbeans, without installing the Maven plugin. I'm not yet entirely sure which versions, or under what circumstances Netbeans lacks maven support. But installing the maven plugin solved this issue. From this point on this installation was clean sailing. The other issue another user at the meeting faced was that the labrepl web pages displayed without any styling/css or code samples... Sadly he had rebooted switching into OS X (from Windows 7) just before Rich managed to answer my query on #clojure IRC. Though apparently Rich's suspicions were true, and that he hadn't installed the latest Enclojure nbm, and was still using a previous version. This said, he claimed to run into the same problem under OS-X with a new install (though we didn't have time to look into this further). Anyway, other than these installation issues (which sadly took up a bit more time than I would have liked), labrepl was well received... It seemed to provide a nice structure to the evening, and allowed me to introduce an experienced O-CAML post-doc Computer Science researcher to Clojure. Coming from no Lisp/Clojure experience he left impressed with the language and with a desire to explore further. He even said he was considering it for future academic work! He particularly liked how lazy sequences were a core language property and idiomatic. (Apparently O-CAML has lazy sequences but many API's don't use them as they're not core). Anyway, I hope these third hand bug reports are relevant to further improving the labrepl docs and installation process. Thanks again to Stuart Halloway for labrepl, and also to Rich, who is still proving to be the best evangelist and ambassador for a language one could hope for, as everyone at the event was amazed when Rich himself helped me diagnose the cause of one of the labrepl installation problems... cheers Rich! This kind of commitment doesn't go unnoticed! -- Rick Moynihan http://twitter.com/RickMoynihan http://delicious.com/InkyHarmonics http://sourcesmouth.co.uk/ -- 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 To unsubscribe, reply using "remove me" as the subject.
Re: intuitive stack trace
On 30 March 2010 14:37, Stuart Sierra wrote: > On Mar 29, 2:23 pm, strattonbrazil wrote: >> I do something wrong, I have to read through the stack which sometimes >> just says there's an error at line 0, which doesn't help me much. > > One problem is that the compiler can't keep track of line numbers in > the REPL (or SLIME). If you load your code from a file you should at > least get line numbers back. > Though this is true when you evaluate an expression, could SLIME or inferior-lisp not track them when you evaluate the whole buffer with something like M-x slime-eval-buffer ? R. -- 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 To unsubscribe, reply using "remove me" as the subject.
Re: Getting started with open source Clojure projects
If you're not stuck on using Compojure, you can try Conjure which will includes all of the dependencies in the jar. To start a hello world app: 1. Download conjure.jar from: http://github.com/macourtney/Conjure/downloads 2. java -jar conjure.jar hello_world 3. cd hello_world 4. ./run.sh script/server.clj 5. Point your browser at http://localhost:8080/ 6. Profit! There is a tutorial for Conjure at: http://wiki.github.com/macourtney/Conjure/hello-world-tutorial-2 -Matt Courtney -- 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 To unsubscribe, reply using "remove me" as the subject.