Re: Confusing Regex Behavior
Oh, handy to know. Thanks. (I come from a mostly Perl background, where regular expressions are first-class objects and operations on/with them are baked in. The Java approach to regexp that Clojure builds on is a little odd to me. But then, Perl is more than a little odd to a lot of people...) Randy On Tue, Dec 4, 2018 at 1:37 PM Justin Smith wrote: > You don't need to use re-matcher in that example - the output of re-find > with the regex and the string is identical. If you are using the matcher to > collect a series of matches in one string, you can also uses re-seq which > returns a lazy-seq of the matches of your regex in the string. > > On Tue, Dec 4, 2018 at 12:37 PM Randy J. Ray wrote: > >> Oh, that might be it. The newline at the end of the string might be what >> is throwing a wrench into things. Though, to be fair, when I used >> re-matches yesterday the newline wasn't an issue. >> >> Nonetheless, I can work with re-find/re-matcher for now. >> >> On Tue, Dec 4, 2018 at 11:28 AM Andy Fingerhut >> wrote: >> >>> The doc string for re-matches says that it >>> uses java.util.regex.Matcher.matches(). The Java doc page for the class >>> java.util.regex.Matcher [1] says "The matches >>> <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#matches--> >>> method >>> attempts to match the entire input sequence against the pattern." >>> >>> The doc string for re-find says that it >>> uses java.util.regex.Matcher.find(). On [1] you can find the statement " >>> The find >>> <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#find--> >>> method >>> scans the input sequence looking for the next subsequence that matches the >>> pattern." >>> >>> I haven't dug into your regex and string in detail, but most likely what >>> is happening is that the regex matches part of the string, but it doesn't >>> match the _entire_ string. >>> >>> Andy >>> >>> [1] >>> https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html >>> >>> >>> >>> >>> On Tue, Dec 4, 2018 at 11:16 AM Randy J. Ray >>> wrote: >>> >>>> I must be doing something wrong here, but I cannot figure this out. >>>> >>>> The following results in "nil" from re-matches: >>>> >>>> (re-matches #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" "[1518-05-27 >>>> 00:42] falls asleep\n") >>>> >>>> This, however, properly matches the line and produces the >>>> backreferences: >>>> >>>> (re-find (re-matcher #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" >>>> "[1518-05-27 00:42] falls asleep\n")) >>>> >>>> I've used re-matches many times, but this has me stumped. This is >>>> behaving this way on both 1.8.0 and 1.9.0. >>>> >>>> Randy >>>> -- >>>> Randy J. Ray - randy.j@gmail.com - twitter.com/rjray >>>> Silicon Valley Scale Modelers: http://www.svsm.org >>>> Sunnyvale, CA >>>> >>>> -- >>>> 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 unsubscribe from this group and stop receiving emails from it, send >>>> an email to clojure+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >>> 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
Re: Confusing Regex Behavior
Oh, that might be it. The newline at the end of the string might be what is throwing a wrench into things. Though, to be fair, when I used re-matches yesterday the newline wasn't an issue. Nonetheless, I can work with re-find/re-matcher for now. On Tue, Dec 4, 2018 at 11:28 AM Andy Fingerhut wrote: > The doc string for re-matches says that it > uses java.util.regex.Matcher.matches(). The Java doc page for the class > java.util.regex.Matcher [1] says "The matches > <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#matches--> > method > attempts to match the entire input sequence against the pattern." > > The doc string for re-find says that it > uses java.util.regex.Matcher.find(). On [1] you can find the statement " > The find > <https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#find--> > method > scans the input sequence looking for the next subsequence that matches the > pattern." > > I haven't dug into your regex and string in detail, but most likely what > is happening is that the regex matches part of the string, but it doesn't > match the _entire_ string. > > Andy > > [1] https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html > > > > > On Tue, Dec 4, 2018 at 11:16 AM Randy J. Ray wrote: > >> I must be doing something wrong here, but I cannot figure this out. >> >> The following results in "nil" from re-matches: >> >> (re-matches #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" "[1518-05-27 >> 00:42] falls asleep\n") >> >> This, however, properly matches the line and produces the backreferences: >> >> (re-find (re-matcher #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" >> "[1518-05-27 00:42] falls asleep\n")) >> >> I've used re-matches many times, but this has me stumped. This is >> behaving this way on both 1.8.0 and 1.9.0. >> >> Randy >> -- >> Randy J. Ray - randy.j@gmail.com - twitter.com/rjray >> Silicon Valley Scale Modelers: http://www.svsm.org >> Sunnyvale, CA >> >> -- >> 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 unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org Sunnyvale, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Confusing Regex Behavior
I must be doing something wrong here, but I cannot figure this out. The following results in "nil" from re-matches: (re-matches #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" "[1518-05-27 00:42] falls asleep\n") This, however, properly matches the line and produces the backreferences: (re-find (re-matcher #"\[((\d+)-(\d+)-(\d+) (\d\d):(\d\d))\] (.*)" "[1518-05-27 00:42] falls asleep\n")) I've used re-matches many times, but this has me stumped. This is behaving this way on both 1.8.0 and 1.9.0. Randy -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org Sunnyvale, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Confused by a bit of syntax-- Clojure(script) or Hiccup?
I've also discovered that ":<>" isn't even in the docs/ directory at all. Fortunately, the couple of places it is used in the examples document it as shorthand for React.Fragment. Randy On Tue, Nov 20, 2018 at 12:49 PM Justin Smith wrote: > I'll add that I knew this, but it took me longer than I expected to > actually find the documentation to point to. I don't know how a new user of > the library would be expected to discover what that symbol means. > > On Tue, Nov 20, 2018 at 12:43 PM Justin Smith > wrote: > >> :> is a valid Clojure keyword, but has no special meaning on its own. >> >> In Reagent's version of the Hiccup DSL, :> introduces a Reagent component >> defined from a React component >> >> https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md#creating-reagent-components-from-react-components >> >> On Tue, Nov 20, 2018 at 11:27 AM Randy J. Ray >> wrote: >> >>> I've been trying to read through and understand the examples in the >>> reagent repo, and I've come across something that I just don't quite get: >>> >>> :> >>> >>> I've looked over all the docs for Clojure, Clojurescript and Hiccup, but >>> find no reference to this. It appears as the first element in vectors in a >>> context that leads me to think it's part of Hiccup. But I'm expecting >>> keywords like ":div", ":p", etc. The ":>" sequence, I guess I'm just not >>> quite getting it? >>> >>> Randy >>> -- >>> Randy J. Ray - randy.j@gmail.com - twitter.com/rjray >>> Silicon Valley Scale Modelers: http://www.svsm.org >>> San Jose, CA >>> >>> -- >>> 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 unsubscribe from this group and stop receiving emails from it, send >>> an email to clojure+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org Sunnyvale, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Confused by a bit of syntax-- Clojure(script) or Hiccup?
Thanks for the pointer! My mistake was looking for this in the source-- had I ack'd over the doc/ directory I would have found it! Randy On Tue, Nov 20, 2018 at 12:49 PM Justin Smith wrote: > I'll add that I knew this, but it took me longer than I expected to > actually find the documentation to point to. I don't know how a new user of > the library would be expected to discover what that symbol means. > > On Tue, Nov 20, 2018 at 12:43 PM Justin Smith > wrote: > >> :> is a valid Clojure keyword, but has no special meaning on its own. >> >> In Reagent's version of the Hiccup DSL, :> introduces a Reagent component >> defined from a React component >> >> https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md#creating-reagent-components-from-react-components >> >> On Tue, Nov 20, 2018 at 11:27 AM Randy J. Ray >> wrote: >> >>> I've been trying to read through and understand the examples in the >>> reagent repo, and I've come across something that I just don't quite get: >>> >>> :> >>> >>> I've looked over all the docs for Clojure, Clojurescript and Hiccup, but >>> find no reference to this. It appears as the first element in vectors in a >>> context that leads me to think it's part of Hiccup. But I'm expecting >>> keywords like ":div", ":p", etc. The ":>" sequence, I guess I'm just not >>> quite getting it? >>> >>> Randy >>> -- >>> Randy J. Ray - randy.j@gmail.com - twitter.com/rjray >>> Silicon Valley Scale Modelers: http://www.svsm.org >>> San Jose, CA >>> >>> -- >>> 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 unsubscribe from this group and stop receiving emails from it, send >>> an email to clojure+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org Sunnyvale, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Confused by a bit of syntax-- Clojure(script) or Hiccup?
I've been trying to read through and understand the examples in the reagent repo, and I've come across something that I just don't quite get: :> I've looked over all the docs for Clojure, Clojurescript and Hiccup, but find no reference to this. It appears as the first element in vectors in a context that leads me to think it's part of Hiccup. But I'm expecting keywords like ":div", ":p", etc. The ":>" sequence, I guess I'm just not quite getting it? Randy -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org San Jose, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Best Practices for Accessing Data Files That May Be Bundled?
First, some brief background/context: I've been playing around with Clojure for a while, mostly just doing Project Euler problems. I'm taking the "Algorithms Specialization" from Coursera, and decided to do all the programming assignments in Clojure as a way of tackling some larger, deeper problems. But overall, my understanding of Clojure overall is still fairly mild. What I want to do, is write some scaffolding around the weekly programming tasks that automates the execution of the user-contributed test-cases. I'd like to be able to add a new form to be tested in a single place (e.g., the project's core.clj file) and have a re-compile be able to find out that the new namespace is now in place, locate the test-files, and execute the form with each test-input. I'm pretty sure I can handle locating the test files as long as they're on the file system (I'm looking at the fs package for walking around the file system). But is there a way to (semi-)transparently handle the data files being resources within the JAR, as well? Also, how would I take a pair of strings (namespace and form-name, respectively) and turn that into the callable function? For example, if my set of desired test-forms were a simple nested list: (("algorithms.class1.week1.karatsuba-mult" "karatsuba-mult") ("algorithms.class1.week2.count-inv" "count-inv") ...) (Currently, the last ns element is the same as the function-name to call, but some of these will have multiple implementations that I'll want to time for comparison, so this won't always be the case.) So, for the first "test", I want to turn ("algorithms.class1.week1.karatsuba-mult" "karatsuba-mult") into a binding that will call algorithms.class1.week1.karatsuba-mult/karatsuba-mult when used as a function. I know how to do this in other languages (my strongest is Perl, but don't hold that against me!), just not in Clojure. The interface of all tests is the same-- they take the name of the input file as a single input, and return a string as a result (I have result-files in the same dirs as the input files, for comparison. I just need to be able to iterate over the forms to test, and the test-cases for each form. (I say "I just need", but I'll probably be back with more questions after I get these answered...) Randy -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org San Jose, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Possible bug in clojure.set/union?
Hi, Fairly-new Clojure enthusiast here, currently using Clojure to work through projecteuler.net problems as a means of learning. While using sets on one of the PE problems, I encountered what *might* be a bug. I admit that I haven't searched the backlog of messages from this group or the issues on GitHub, so if this is already known I apologize. Here is the issue: I discovered that I could pass a list as the second parameter to set/union, and it would be merged into the the set passed as the first parameter and the new resulting set returned. However, if the number of items in the list exceeds the number of items in the set, then the return value is a list with any duplicate elements completely present. To illustrate, here is a snippet from my REPL: user=> (require '[clojure.set :as set]) nil user=> (set/union #{1 2 3} #{2 3 4}) #{1 4 3 2} user=> (set/union #{1 2 3} #{2 3 4 5}) #{1 4 3 2 5} user=> (set/union #{1 2 3} (list 2 3 4)) #{1 4 3 2} user=> (set/union #{1 2 3} (list 2 3 4 5)) (2 3 1 2 3 4 5) Note that the last expression yields a list of 7 elements rather than a set of 5. I have not tried this with more than two arguments, so I don't know that would affect the output. I did try putting a list as the first parameter, and that results in a list return value all the time. Is this a bug? Should I file a GitHub issue on this? I first encountered this in 1.7.0, but I recently updated to 1.8.0 and it is still present. Randy -- Randy J. Ray - randy.j@gmail.com - twitter.com/rjray Silicon Valley Scale Modelers: http://www.svsm.org Sunnyvale, CA -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure, Swank, and Leiningen with Emacs on Mac OS X
The contents of .clojure are not at issue, clojure runs just fine from the command-line, repl, etc. My problem is with installing SLIME, clojure-mode, etc. without using package.el. When I tried it, it failed somewhere in the building/compiling of clojure-mode.el, and the SLIME package was not complete. Starting with the ESK is not an option for me, as I have too much invested in my current emacs configuration. Currently, I keep my emacs configuration on github, as part of a larger repo that houses all my dot-files (I really should move the emacs stuff into its own repo, now that I think about it). So I have no problems with downloading the packages I need, installing them into my configuration manually, etc. I don't mind doing things in a slightly harder way than the ESK presents, I just need to know which versions of things like SLIME I should use (the SLIME web page only has a download for the latest CVS head version). Randy On Tue, Jun 7, 2011 at 6:00 PM, John Toohey wrote: > I have a fully working AquaEmacs/Swank/Slime system under OSX. Can you > tell me what you tried, and I may be able to help you. To start with, > what is the content of you ~/.clojure directory? > > On Tue, Jun 7, 2011 at 18:00, Randy J. Ray wrote: > > I am also having some big problems getting a working set-up under MacOS. > I > > can't really start with the emacs-starters-kit, as I have a very large > > existing configuration. And Aquamacs doesn't ship SLIME as part of the > > distribution. Mainly, I need to know the best place to get the > clojure-mode, > > clojure-test-mode, slime and swank-clojure packages. I tried using > > package.el to get some of them, but it bombed out before it completed > > building/installing slime or clojure-mode. I considered getting slime > from > > their web page, but their only download link is a CVS snapshot, and I > seem > > to remember reading somewhere that the really-new slime versions had some > > problems. > > Is part of the problem my decision to use Aquamacs? I looked at Carbon > Emacs > > as well, but that's based on an emacs 22 source base, and I'd prefer to > work > > from 23 or newer (my Linux desktops are running emacs in the 23 range). > Do > > people roll their own emacs for clojure development on MacOS? > > Randy > > > > On Fri, May 27, 2011 at 7:40 AM, Sathish Kumar > wrote: > >> > >> Hi, > >> This is a step by step guide to setup Leiningen, Swank-Clojure and SLIME > >> for Emacs. > >> > >> http://languageagnostic.blogspot.com/2011/05/clojure-in-emacs.html > >> > >> It is partly based on technomancy's post here http://technomancy.us/126 > >> > >> Thanks, > >> Sathish > >> > >> On Wed, May 25, 2011 at 12:21 PM, michele > wrote: > >>> > >>> And this one > >>> > >>> https://github.com/technomancy/leiningen/ > >>> > >>> On May 22, 10:53 am, dokondr wrote: > >>> > Hello, > >>> > I am trying to install Clojure tools on Mac OS X according to the > >>> > instructions: > >>> > "Clojure, Swank, and Leiningen with Emacs on > >>> > Linux"http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html > >>> > > >>> > Everything goes fine until these steps: > >>> > > >>> > ~$ lein deps > >>> > > >>> > ~$ lein swank > >>> > > >>> > In my project.clj I have: > >>> > > >>> > (defproject test-project "0.1.0" > >>> > :description "Test Project" > >>> > :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"] > >>> > [org.clojure/clojure-contrib "1.3.0-SNAPSHOT"]] > >>> > :dev-dependencies [[swank-clojure "1.2.1"]]) > >>> > > >>> > Running 'lein deps' gives these errors: > >>> > > >>> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- > >>> > contrib-1.3.0-SNAPSHOT.pom from cloju\ > >>> > re-snapshots > >>> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- > >>> > contrib-1.3.0-SNAPSHOT.pom from cloja\ > >>> > rs > >>> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- > >>> > contrib-1.3.0-SNAPSHOT.jar from cloju\ > >>> > re-snapshots > >>> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- > >&
Re: Clojure, Swank, and Leiningen with Emacs on Mac OS X
I am also having some big problems getting a working set-up under MacOS. I can't really start with the emacs-starters-kit, as I have a very large existing configuration. And Aquamacs doesn't ship SLIME as part of the distribution. Mainly, I need to know the best place to get the clojure-mode, clojure-test-mode, slime and swank-clojure packages. I tried using package.el to get some of them, but it bombed out before it completed building/installing slime or clojure-mode. I considered getting slime from their web page, but their only download link is a CVS snapshot, and I seem to remember reading somewhere that the really-new slime versions had some problems. Is part of the problem my decision to use Aquamacs? I looked at Carbon Emacs as well, but that's based on an emacs 22 source base, and I'd prefer to work from 23 or newer (my Linux desktops are running emacs in the 23 range). Do people roll their own emacs for clojure development on MacOS? Randy On Fri, May 27, 2011 at 7:40 AM, Sathish Kumar wrote: > Hi, > This is a step by step guide to setup Leiningen, Swank-Clojure and SLIME > for Emacs. > > http://languageagnostic.blogspot.com/2011/05/clojure-in-emacs.html > > It is partly based on technomancy's post here http://technomancy.us/126 > > Thanks, > Sathish > > On Wed, May 25, 2011 at 12:21 PM, michele wrote: > >> And this one >> >> https://github.com/technomancy/leiningen/ >> >> On May 22, 10:53 am, dokondr wrote: >> > Hello, >> > I am trying to install Clojure tools on Mac OS X according to the >> > instructions: >> > "Clojure, Swank, and Leiningen with Emacs on Linux" >> http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html >> > >> > Everything goes fine until these steps: >> > >> > ~$ lein deps >> > >> > ~$ lein swank >> > >> > In my project.clj I have: >> > >> > (defproject test-project "0.1.0" >> > :description "Test Project" >> > :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"] >> > [org.clojure/clojure-contrib "1.3.0-SNAPSHOT"]] >> > :dev-dependencies [[swank-clojure "1.2.1"]]) >> > >> > Running 'lein deps' gives these errors: >> > >> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- >> > contrib-1.3.0-SNAPSHOT.pom from cloju\ >> > re-snapshots >> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- >> > contrib-1.3.0-SNAPSHOT.pom from cloja\ >> > rs >> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- >> > contrib-1.3.0-SNAPSHOT.jar from cloju\ >> > re-snapshots >> > Downloading: org/clojure/clojure-contrib/1.3.0-SNAPSHOT/clojure- >> > contrib-1.3.0-SNAPSHOT.jar from cloja\ >> > rs >> > An error has occurred while processing the Maven artifact tasks. >> > Diagnosis: >> > >> > Unable to resolve artifact: Missing: >> > -- >> > 1) org.clojure:clojure-contrib:jar:1.3.0-SNAPSHOT >> > >> > Try downloading the file manually from the project website. >> > >> > Then, install it using the command: >> > mvn install:install-file -DgroupId=org.clojure - >> > DartifactId=clojure-contrib -Dversion=1.3.0-SNA\ >> > PSHOT -Dpackaging=jar -Dfile=/path/to/file >> > >> > Alternatively, if you host your own repository you can deploy the >> > file there: >> > mvn deploy:deploy-file -DgroupId=org.clojure - >> > DartifactId=clojure-contrib -Dversion=1.3.0-SNAPS\ >> > HOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] - >> > DrepositoryId=[id] >> > >> > Path to dependency: >> > 1) org.apache.maven:super-pom:jar:2.0 >> > 2) org.clojure:clojure-contrib:jar:1.3.0-SNAPSHOT >> > >> > When I run 'lein swank' I get: >> > >> > "That's not a task. Use "lein help" to list all tasks." >> > >> > Any ideas how to install these tools without so much pain? >> > >> > Thanks, >> > Dmitri >> >> -- >> 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 >>
Re: Clojure Quizzes?
On 01/12/2011 11:50 PM, Robert McIntyre wrote: They seem to allow you to include anything in a lib directory that you'd want. I sometimes include apache commons-io and clojure-contrib1.2 without any problems. I also included a sql connection library for one of the problems, so it seems fine :) For those puzzles that require command-line processing, have you used a library to do it? Looking in both "Programming Clojure" and "Practical Clojure", the only instruction I can find on handling command-line args involves AOT compilation of your class and definition of a -main method. I'm not sure how well this would work with the submission model that Coderloop uses. I'm afraid I'm still *very* new to Clojure, and while it would be easy (for me) to solve the problems in other languages, the point of the exercise (for me) is to use Coderloop's problems to help myself in learning Clojure... Randy -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Randy J. Ray Sunnyvale, CA http://www.rjray.org rj...@blackperl.com http://www.svsm.org randy.j@gmail.com http://twitter.com/rjray -- 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: Having trouble with "reader.tasklist" class from Programming Clojure
On 01/04/2011 01:17 PM, Stuart Halloway wrote: Things to try: (1) Is the directory that contains "reader" on your classpath? (2) Does it run with the provided script/repl.sh or script\repl.bat scripts? When I ran it, I was in the directory that contains "reader" (and "classes"), and "." was in my classpath. I ran it with the "bin/repl.sh" in the github distro, and it successfully compiled the class. I noticed that *that* REPL was using 1.1.0-alpha-SNAPSHOT. So from the exact same directory (with "reader" and "classes" in the current directory) I ran: java -cp .:/home/users/rjray/lib/clojure/clojure-contrib.jar:/home/users/rjray/lib/clojure/clojure.jar:/home/users/rjray/lib/java/jline.jar jline.ConsoleRunner clojure.main Note the "." at the head of classpath (plus, it's finding the class to start compiling it, it just isn't finding it when it references itself). The paths to clojure.jar and clojure-contrib.jar are the 1.2.0 distribution jars, stock downloads from clojure.org. And with that REPL, it reported the error. Randy -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Randy J. Ray Sunnyvale, CA http://www.rjray.org rj...@blackperl.com http://www.svsm.org randy.j@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
Having trouble with "reader.tasklist" class from Programming Clojure
Hello everyone. I am just starting out in Clojure by working through Programming Clojure. I have run into a snag, though, on the reader/tasklist.clj example in chapter 3. I am getting the following error consistently: user=> (compile 'reader.tasklist) java.lang.ClassNotFoundException: reader.tasklist (tasklist.clj:13) Line 13 is this line in the task-list defn: (let [handler (new reader.tasklist)] My complete reader/tasklist.clj is: (ns reader.tasklist (:gen-class :extends org.xml.sax.helpers.DefaultHandler :state state :init init) (:use [clojure.contrib.duck-streams :only (reader)]) (:import [java.io File] [org.xml.sax InputSource] [org.xml.sax.helpers DefaultHandler] [javax.xml.parsers SAXParserFactory])) (defn task-list [arg] (let [handler (new reader.tasklist)] (.. SAXParserFactory newInstance newSAXParser (parse (InputSource. (reader (File. arg))) handler)) @(.state handler))) (defn -main [& args] (doseq [arg args] (println (task-list arg (defn -init [] [[] (atom [])]) (defn -startElement [this uri local qname atts] (when (= qname "target") (swap! (.state this) conj (.getValue atts "name" I've compared this very thoroughly to examples/tasklist.clj in the Github dist, but can't find any errors. I'm working in a directory that has a "reader" sub-dir and a "classes" sub-dir. "tasklist.clj" is in the "reader" directory. My REPL is launched from my own hand-rolled launcher, but the command it executes is basically: java -cp .:/home/users/rjray/lib/clojure/clojure-contrib.jar:/home/users/rjray/lib/clojure/clojure.jar:/home/users/rjray/lib/java/jline.jar jline.ConsoleRunner clojure.main Everything up to now has run fine from within the REPL, this is the first time I've tried compiling a class. I get the same error if I try C-c C-k from a SLIME-enabled buffer in Emacs, as well. Any suggestions? Randy -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Randy J. Ray Sunnyvale, CA http://www.rjray.org rj...@blackperl.com http://www.svsm.org randy.j@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