Module For COM Objects
Does Clojure have a module that allows initializing, passing data to, and finalizing COM objects? I am asking, because I need to write a Clojure program to communicate with a COM toolkit. Thanks. -- -- 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/groups/opt_out.
Re: Natively Compiled Clojure
Thanks. I took your link and posted it as a comment on stackoverflow. On Monday, January 21, 2013 1:15:05 PM UTC-5, Shantanu Kumar wrote: > > > What triggered this was this morning I saw something on > stackoverflow.comabout Clojure's possibly interacting with C code, and the > natively compiled > > question just popped into my head. > > Could Clojure-JNA help there, or is it some other use-case? > https://github.com/Chouser/clojure-jna > > Shantanu > -- 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: Natively Compiled Clojure
I've had no problems. I am just curious. What triggered this was this morning I saw something on stackoverflow.comabout Clojure's possibly interacting with C code, and the natively compiled question just popped into my head. On Monday, January 21, 2013 12:19:27 PM UTC-5, tbc++ wrote: > > If you haven't found a performance problem, and it's working well for your > needs, why are you interested in making the code run "natively". What > problems have you encountered that pique your intrest in this area? > > Timothy > > > > > On Mon, Jan 21, 2013 at 9:29 AM, octopusgrabbus > > > wrote: > >> I use Clojure primarily as a very reliable tool to aid in data >> transformations, that is taking data in one application's database and >> transforming it into the format needed for another applications' database. >> >> So, my question is would a natively compiled Clojure make sense or turn >> the language into something that was not intended? In almost all instances >> I have not found a problem with Clojure's execution speed so my question is >> not about pro or anti Java. >> >> Thanks. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@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+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) > -- 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
Natively Compiled Clojure
I use Clojure primarily as a very reliable tool to aid in data transformations, that is taking data in one application's database and transforming it into the format needed for another applications' database. So, my question is would a natively compiled Clojure make sense or turn the language into something that was not intended? In almost all instances I have not found a problem with Clojure's execution speed so my question is not about pro or anti Java. Thanks. -- 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
Is There An Upcoming Book On Clojure Macros?
I have most of the Clojure text books available, and have found them all to be quite good. Each one seems to have a different focus, which, depending on the problem at the time, shines light on my particular problem du jour. IMHO, while the current crop of books is quite good, none that I've seen so far talk about Clojure's macros in heavy detail, like for more than a chapter. I am reading Doug Hoyte's Let Over Lambda, and am wondering if there is a more macro-focused book in the works for Clojure. I like Let Over Lambda, because it is the first book I've seen so far that blends in topics of how variables are represented on the stack along with presenting Lisp macros. Thanks. -- 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: Adding a comma to end of clojure sequence
This is solved. I am adding a blank field, which gets me my trailing comma. On Tuesday, November 6, 2012 2:40:19 PM UTC-5, octopusgrabbus wrote: > > Is it possible to add an unquoted comma at the end of a Clojure sequence, > while using clojure.data.csv's write-csv? > > (defn write-csv-file > "Writes a csv file using a key and an s-o-s" > [out-sos out-file] > > (if (= dbg 1) > (println (first out-sos), "\n", out-file)) > > (spit out-file "" :append false) > (with-open [out-data (io/writer out-file)] > (csv/write-csv out-data out-sos))) > > This code writes my sequence of sequences out just fine. All I want to do is > add a trailing comma. > > > -- 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
Adding a comma to end of clojure sequence
Is it possible to add an unquoted comma at the end of a Clojure sequence, while using clojure.data.csv's write-csv? (defn write-csv-file "Writes a csv file using a key and an s-o-s" [out-sos out-file] (if (= dbg 1) (println (first out-sos), "\n", out-file)) (spit out-file "" :append false) (with-open [out-data (io/writer out-file)] (csv/write-csv out-data out-sos))) This code writes my sequence of sequences out just fine. All I want to do is add a trailing comma. -- 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: Origin of tools.cli optional
Thanks for your answer. I will adapt the small number of programs I have to the newer version of the library. Rather than criticize your efforts in a language in which I am still very much a student, I will just say I miss the required optional syntax. Other than that, your library is extremely helpful, whether I have to back-adapt or not. Thanks again. On Friday, August 24, 2012 7:41:56 PM UTC-4, Gaz wrote: > > The library was originally based on Clargon (a library I wrote) which > had the interface you are describing (optional and required > functions). Various changes were made after getting feedback on the > clojure-dev mailing list, which you can read about here if you're > interested: > > https://groups.google.com/d/topic/clojure-dev/KGvzndhX5vk/discussion > > Hopefully the project documentation is clear about its use: > > https://github.com/clojure/tools.cli > > Hope that helps, > > Gaz > > On Fri, Aug 24, 2012 at 2:52 PM, octopusgrabbus > > wrote: > > Given the following code > > > > (defn parse-opts > > "Using the newer cli library, parses command line args." > > [args] > > (cli args > >(optional ["--in-file-name" ".csv input file" :default > > "resultset.csv"] identity) > >(optional ["--out-file-name" ".csv pipe delimited output file" > > :default "accumail_out.unl"] ))) > > > > What is the origin of optional, and why do tools.cli examples that I can > > find now leave out (optional ... ? > > > > Would current examples still use identity? > > > > Here is why I'm asking: > > > > > http://stackoverflow.com/questions/12112403/how-do-i-mix-non-optional-cli-arguments-with-optional-ones > > > > > Thanks for any pointers or help. > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@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+u...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Origin of tools.cli optional
Given the following code (defn parse-opts "Using the newer cli library, parses command line args." [args] (cli args (optional ["--in-file-name" ".csv input file" :default "resultset.csv"] identity) (optional ["--out-file-name" ".csv pipe delimited output file" :default "accumail_out.unl"] ))) What is the origin of optional, and why do tools.cli examples that I can find now leave out (optional ... ? Would current examples still use identity? Here is why I'm asking: http://stackoverflow.com/questions/12112403/how-do-i-mix-non-optional-cli-arguments-with-optional-ones Thanks for any pointers or help. -- 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: Scheme dotted pair equivalent in Clojure
Thanks for answering. I am taking from your answer that I can be Lisp/Clojure-esque in Scheme and not worry about dotted pairs. That is, I can make a grid out of lists, rather than using cons to construct them. That's what I'm trying to do. On Saturday, June 16, 2012 11:35:14 AM UTC-4, octopusgrabbus wrote: > > I have a need to learn enough scheme to read it and write a few functions. > I came across dotted pair notation. I am trying to grok it in terms of the > only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to > form in Clojure, and if so, how? > > > -- 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
Scheme dotted pair equivalent in Clojure
I have a need to learn enough scheme to read it and write a few functions. I came across dotted pair notation. I am trying to grok it in terms of the only Lisp I know, Clojure. Does dotted pair notation in Scheme compare to form in Clojure, and if so, how? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure-csv library write-csv examples
Thank you. That clears things up quite a bit, when you said another library. On Friday, June 15, 2012 10:30:04 AM UTC-4, Walter Tetzner wrote: > > On Friday, June 15, 2012 10:01:24 AM UTC-4, octopusgrabbus wrote: >> >> The reason why I asked this question is this code looks like it's using >> another csv library, so I'm confused. >> > > That's because it is using another csv library: > https://github.com/clojure/data.csv. > > clojure-csv: https://github.com/davidsantiago/clojure-csv > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure-csv library write-csv examples
The reason why I asked this question is this code looks like it's using another csv library, so I'm confused. (require '[clojure.data.csv :as csv] '[clojure.java.io :as io]) (with-open [in-file (io/reader "in-file.csv")] (doall (csv/read-csv in-file))) (with-open [out-file (io/writer "out-file.csv")] (csv/write-csv out-file [["abc" "def"] ["ghi" "jkl"]])) On Friday, June 15, 2012 9:57:03 AM UTC-4, octopusgrabbus wrote: > > I would appreciate getting a pointer to some clojure-csv library write-csv > examples. > > Thank you. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
clojure-csv library write-csv examples
I would appreciate getting a pointer to some clojure-csv library write-csv examples. Thank you. -- 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: If Using nth Creates Dependencies, What Is The Best Way To Pull Data Elements From A Sequence
Pulling the data out of each csv row as a map would eliminate nth. That is a good idea, and I'll add it to my tool bag. On Friday, May 18, 2012 11:37:12 AM UTC-4, Alex Robbins wrote: > > I wonder if the idea was that you are better off using a hash-map and > key lookups so the positions are labeled. Some csv libs return a seq > of maps where the keys are the column header values. That way you'd be > able to select data by name instead of a sometimes arbitrary position. > > Just a guess. > Alex > > On Fri, May 18, 2012 at 10:05 AM, David Nolen > wrote: > > There's nothing wrong with using nth far as I know. > > > > > > On Fri, May 18, 2012 at 11:03 AM, octopusgrabbus < > octopusgrab...@gmail.com> > > wrote: > >> > >> In our production development environment, we perform a lot of data > >> transfers between diverse systems, and most of those transfers involve > >> comma-delimited (.csv) data. So my first small Clojure applications > have > >> revolved around the clojure-csv library. > >> > >> While learning Clojure I have seen the comment that using nth "stinks", > >> because it creates dependencies. Wanting to do things in a Clojure way, > I > >> have a question. > >> > >> If I need to extract a number of columns of a spreadsheet to minimize > the > >> dataset and this happens as the application is reading in and > initializing > >> its data, what should I use to extract those columns other than nth? > And, if > >> I use a series first and rest, isn't that also positional? > >> > >> I've thought of ways to re-position the data initially, so comparison > >> columns between two different spreadsheets that have one unique key > column > >> in common would be accessible with first, for example. However, I would > >> still need to get at that data by column in order to reposition it, > hence > >> the need for nth. > >> > >> > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Clojure" group. > >> To post to this group, send email to clojure@googlegroups.com > >> Note that posts from new members are moderated - please be patient with > >> your first post. > >> To unsubscribe from this group, send email to > >> clojure+unsubscr...@googlegroups.com > >> For more options, visit this group at > >> http://groups.google.com/group/clojure?hl=en > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: If Using nth Creates Dependencies, What Is The Best Way To Pull Data Elements From A Sequence
Thanks for your comment, Tim. You provided a good example and comments on my blog. On Friday, May 18, 2012 4:35:26 PM UTC-4, Tim Visher wrote: > > On Fri, May 18, 2012 at 11:03 AM, octopusgrabbus > wrote: > > In our production development environment, we perform a lot of data > > transfers between diverse systems, and most of those transfers involve > > comma-delimited (.csv) data. So my first small Clojure applications have > > revolved around the clojure-csv library. > > > > While learning Clojure I have seen the comment that using nth "stinks", > > because it creates dependencies. Wanting to do things in a Clojure way, > I > > have a question. > > > > If I need to extract a number of columns of a spreadsheet to minimize > the > > dataset and this happens as the application is reading in and > initializing > > its data, what should I use to extract those columns other than nth? > And, if > > I use a series first and rest, isn't that also positional? > > > > I've thought of ways to re-position the data initially, so comparison > > columns between two different spreadsheets that have one unique key > column > > in common would be accessible with first, for example. However, I would > > still need to get at that data by column in order to reposition it, > hence > > the need for nth. > > I think the point of the parts of the discussion that I've been privy > to so far is mostly that `nth` is something that a novice clojurist > might reach for because they don't have a grasp of the sequence > abstraction as well as stream operations and laziness, in the same way > that many people immediately reach for loop/recur when some form of > list comprehension would've solved the problem better. > > Once you have your mind around these other concepts (or perhaps even > before, this is a practical language after all) there's absolutely > nothing wrong with `nth`. It just probably shouldn't be everywhere in > your code unless your domain (like, say, a domain heavy in csv data, > perhaps?) supports the need for it. > > It does tie you to ordering so it may be worth the effort to pour your > non-tagged csv data into maps so that your implementation code can be > happily ignorant if the order of the fields ever changes. You may know > things about your domain that would be good counterarguments to that. > > Anyway, good to know you're still soldiering on. ;) > > -- > > Timmy V. > > http://twonegatives.com/ > http://five.sentenc.es/ -- Spend less time on mail. > -- 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
If Using nth Creates Dependencies, What Is The Best Way To Pull Data Elements From A Sequence
In our production development environment, we perform a lot of data transfers between diverse systems, and most of those transfers involve comma-delimited (.csv) data. So my first small Clojure applications have revolved around the clojure-csv library. While learning Clojure I have seen the comment that using nth "stinks", because it creates dependencies. Wanting to do things in a Clojure way, I have a question. If I need to extract a number of columns of a spreadsheet to minimize the dataset and this happens as the application is reading in and initializing its data, what should I use to extract those columns other than nth? And, if I use a series first and rest, isn't that also positional? I've thought of ways to re-position the data initially, so comparison columns between two different spreadsheets that have one unique key column in common would be accessible with first, for example. However, I would still need to get at that data by column in order to reposition it, hence the need for nth. -- 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: Compiling Libraries With :aot
Thanks for the replies. My technical instincts were to compile :aot without having enough JVM, Java, or Clojure experience. How do you request lein to remove the source code? On Wednesday, April 4, 2012 3:22:01 PM UTC-4, octopusgrabbus wrote: > > Is there any reason to compile a Clojure library with :aot? > > (defproject bene-csv "1.0.0-SNAPSHOT" > :description "A csv parsing library" > :dependencies [[org.clojure/clojure "1.3.0"] > [clojure-csv/clojure-csv "1.3.2"]] > :aot [bene-csv.core]) > > How does compiling or not compiling such a project with :aot affect the > Clojure "main" project that "requires" the library? > > Thanks. > On Wednesday, April 4, 2012 3:22:01 PM UTC-4, octopusgrabbus wrote: > > Is there any reason to compile a Clojure library with :aot? > > (defproject bene-csv "1.0.0-SNAPSHOT" > :description "A csv parsing library" > :dependencies [[org.clojure/clojure "1.3.0"] > [clojure-csv/clojure-csv "1.3.2"]] > :aot [bene-csv.core]) > > How does compiling or not compiling such a project with :aot affect the > Clojure "main" project that "requires" the library? > > Thanks. > On Wednesday, April 4, 2012 3:22:01 PM UTC-4, octopusgrabbus wrote: > > Is there any reason to compile a Clojure library with :aot? > > (defproject bene-csv "1.0.0-SNAPSHOT" > :description "A csv parsing library" > :dependencies [[org.clojure/clojure "1.3.0"] > [clojure-csv/clojure-csv "1.3.2"]] > :aot [bene-csv.core]) > > How does compiling or not compiling such a project with :aot affect the > Clojure "main" project that "requires" the library? > > Thanks. > On Wednesday, April 4, 2012 3:22:01 PM UTC-4, octopusgrabbus wrote: > > Is there any reason to compile a Clojure library with :aot? > > (defproject bene-csv "1.0.0-SNAPSHOT" > :description "A csv parsing library" > :dependencies [[org.clojure/clojure "1.3.0"] > [clojure-csv/clojure-csv "1.3.2"]] > :aot [bene-csv.core]) > > How does compiling or not compiling such a project with :aot affect the > Clojure "main" project that "requires" the library? > > Thanks. > On Wednesday, April 4, 2012 3:22:01 PM UTC-4, octopusgrabbus wrote: > > Is there any reason to compile a Clojure library with :aot? > > (defproject bene-csv "1.0.0-SNAPSHOT" > :description "A csv parsing library" > :dependencies [[org.clojure/clojure "1.3.0"] > [clojure-csv/clojure-csv "1.3.2"]] > :aot [bene-csv.core]) > > How does compiling or not compiling such a project with :aot affect the > Clojure "main" project that "requires" the library? > > Thanks. > -- 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
Compiling Libraries With :aot
Is there any reason to compile a Clojure library with :aot? (defproject bene-csv "1.0.0-SNAPSHOT" :description "A csv parsing library" :dependencies [[org.clojure/clojure "1.3.0"] [clojure-csv/clojure-csv "1.3.2"]] :aot [bene-csv.core]) How does compiling or not compiling such a project with :aot affect the Clojure "main" project that "requires" the library? Thanks. -- 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: Comments in .clj file appear not to work
Thanks. -- 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
Comments in .clj file appear not to work
I downloaded seesaw-repl-tutorial.clj. which is attached. When I enter (load-file "seesaw-repl-tutorial.clj") I get this error: CompilerException java.lang.RuntimeException: Unable to resolve symbol: $ in this context, compiling:(/home/cnorton/projects/clojure/hello-seesaw/seesaw-repl-tutorial.clj:34) I downloaded the tutorial from github, so unless the file is in a weird state that I'm not seeing -- vim says it's a unix file (I'm on Ubuntu ) -- I'm not sure why the comment lines are allowing the $ symbol to be evaluated. Any ideas? Thank you. -- 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 seesaw-repl-tutorial.clj Description: Binary data
How do I add a MyClass.java module to my Clojure cake build?
I have a working Clojure cake build and want to build a .java file into my "bin". What changes do I need in my project and application files to have cake build the file? Thanks. The directory structure is: ./bank2/project.clj ./bank2/src/ba2_app.clj The header of ba2_app.clj is (ns ba2-app (:gen-class) (:use [clojure.string :only [split]] [clojure.string :only [join]])) My Java class file is simple: import java.util.Date; public class Account { private int acct_num = 0; private char trans_type; private double trans_amt = 0.00; private double cur_bal = 0.00; private Date last_update; } -- 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 project.clj Description: Binary data
Re: How to convert general recursion to loop .. recur syntax
Thanks for clarifying the stack space issue. I got confused with the original implementation, and was unsure it would run with a large sequence. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to convert general recursion to loop .. recur syntax
Alan: I may have misunderstood what I've read both in books, blogs, and the Clojure site, but it seems that writing recursive functions in the loop .. recur style is the preferred style. I also remember most of the texts currently out on Clojure say use the higher level sequence functions rather than recursion. I get it. I wanted to do this particular exercise without the aid of Clojure.zip. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to convert general recursion to loop .. recur syntax
Thanks. I'll have a look. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to convert general recursion to loop .. recur syntax
Jeff: loop .. recur syntax is Clojure's preferred method of recursion. This is a routine to return the skeleton of a sequence, not its values. cmn -- 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
How to convert general recursion to loop .. recur syntax
I need help -- ideas, other places or examples to look at, etc -- in converting this function (defn skl [tree] (map skl (filter seq? tree))) to loop .. recur syntax. I've been testing it with (def test_data1 '(1 (2 3) ( ) (( )) :a)) (def test_data2 '(1 2 (3 4) (5 ( 6 7 8 I'm trying to do this without the clojure.zip library. Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
Thanks. Something got out of whack when I copied it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
Lee: I tried (defn skeleton [tree] (map skeleton (filter seq? tree))) with (def test_data1 '(1 (2 3) ( ) (( )) :a)) and got a Java out of memory error. Where is the condition end recursion condition? tnx cmn -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
http://www.cis.upenn.edu/~matuszek/cis554-2010/Assignments/clojure-01-exercises.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
This isn't a request to get help w/ a 4Clojure problem, and I am not specifically asking for help with producing the skeleton (the tree structure without the leaves) of the sequences show below, although I would be appreciative of help. Instead I am asking if a solution to do this is simple or requires an approach like clojure-zip. Thanks for the 4clojure group link. Didn't know it existed. (def test_data1 '(1 (2 3) ( ) (( )) :a)) (def test_data2 '(1 2 (3 4) (5 ( 6 7 8 (def test_dat(1 (2 (3 4)) 5 6 (7) ( ))) -- 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
How To Empty A Tree or Returning The Skelton of A Tree Without Leaves
When I started learning Clojure, I did not want to be a casual user that shyed away from Clojure's native syntax, preferring to do as much as possible in Java. To that end, I discovered some graduate computer science Clojure exercises and started working them. I know about 4Clojure, but these exercises made my head hurt, but as the Gary Larson cartoon told it, it was a "good kind of hurt". By forgoing the use of flatten and trying to roll my own, I gained some insights of how sequences are constructed and what they actually are. However, coming across the exercise to return the skeleton of a tree, I immediately thought of meta data, but I'm not sure this exercise was designed to encourage the students to use the clojure.zip routines. So, my question is, using elementary primitives, is it reasonable to return a list without its leaves, or do you really need the clojure.zip functions? Thanks. -- 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: Differences Between seq? and sequential?
And in flattening a list (by hand, not using flatten), why it important to check for sequential instead of seq and where can I read about that? I understand one answer. That is all seqs are sequential. But is there more discussion on this? Thanks. cmn -- 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
Documentation For Lisp Programming in Clojure.
I have seen the three current books on Clojure. They are all good general books that describe the whole language. I have not had a chance to see Chas Emerick's new Clojure O'Reilly book, so cannot comment on that. Are there any books available or upcoming that concentrate more on Lisp programming in Clojure's dialect? If not, what is the closest Lisp dialect to Clojure and is the best book on teaching traversing trees, recursion, and so on? Thanks. cmn -- 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: (deftrace sample
Forgot about doing this: (:require [clojure.contrib.trace :as ctr]) cmn -- 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
(deftrace sample
Does anyone have a deftrace sample handy? I'm getting Caused by: clojure.lang.Compiler$CompilerException: java.lang.Exception: Unable to resolve symbol: deftrace in this context (repl_test.clj:15) in (ns repl-test (:gen-class) (:use clojure.contrib.command-line) (:require [clojure.contrib.string :as cstr]) (:require clojure.contrib.trace) (:use clojure-csv.core)) (def d3 [1 2 3 1 4 1 2]) (defn x-in-seq [x temp-seq] (if (nil? (some #(= x %) temp-seq)) x)) (deftrace f1 [in-seq] (loop [new-seq [] cur-seq in-seq] (if (nil? cur-seq) new-seq (if-not (nil? (x-in-seq (first cur-seq) new-seq)) (recur (conj new-seq (first cur-seq)) (rest cur-seq)) (recur new-seq (rest cur-seq)) (defn -main [& args] -- 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: Why can't I print new sequence?
Ken: Thanks for the answer. You're correct about distinct. I'm working through some exercises. cmn -- 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
Why can't I print new sequence?
I am probably missing something fundamental in the following example, which is trying to remove duplicates from a sequence. What am I doing wrong? I call it with (f1 d3). Thanks. cmn (ns test-csv (:gen-class) (:use clojure.contrib.command-line) (:require [clojure.contrib.string :as cstr]) (:use clojure-csv.core)) (def d3 [1 2 3 1 4 1 2]) (defn x-in-seq [x temp-seq] (if (nil? (some #(= x %) temp-seq)) x)) (defn f1 [in-seq] (loop [new-seq [] cur-seq in-seq] (if (nil? (first cur-seq)) new-seq (if-not (nil? (x-in-seq (first cur-seq) new-seq)) (recur (conj new-seq (first cur-seq)) (rest cur-seq)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: One name space / Multiple Modules
Sure. module = .clj file On Aug 5, 2:35 am, Laurent PETIT wrote: > 2011/8/4 octopusgrabbus > > > Can more than one module implement the same name space? In other > > words, can the functions that comprise a name space be spread out in > > multiple modules? > > To help answer the right question, maybe you could explain what is your > definition of "module" (there's currently no "module" concept in Clojure, so > this is currently open to interpretation ...) > > > > > > > > > > > Thanks. > > cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
One name space / Multiple Modules
Can more than one module implement the same name space? In other words, can the functions that comprise a name space be spread out in multiple modules? Thanks. cmn -- 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: Adding "Change History" To Clojure Modules
Thanks. This makes more sense putting it there. On Aug 4, 10:46 am, Joop Kiefte wrote: > In that case I would suggest putting it on top of the file more > or less like this > with a lot of ;'s at the start. You could create a script to > update that automatically > from the CVS I suppose, and if you make sure it's autogenerated > and that it comes > from the CVS it gives a lot more insight for both sides. But > that's my opinion. > At least I wouldn't put it in the docstring. > > (ns code-starts-here ...) > > 2011/8/4 octopusgrabbus : > > > > > > > > > We have a fairly simple development environment here, not that it > > couldn't stand updating, but other than a consultant, I am the only > > developer. I need changes written directly into each file. and here is > > why. > > > When I got here over seven years ago, there were well over 200 4GL > > modules and a smattering of C modules built into Informix's customized > > runner for 4GL pcode. Almost no module had comments; and almost no > > module had module header information. We also had no formal build. > > > Yes, I could look things up in CVS, but I find it better to have stuff > > written in the header. > > > I'm using $Log$, and it works. > > > Thanks. > > > On Aug 3, 5:36 pm, Sean Corfield wrote: > >> I think Joop meant to use the change history in your version control system > >> directly, rather than try to put it into the source code. > > >> I think the prevailing best practices these days are to _not_ duplicate > >> change history into source code, even thru VCS keyword substitution. The > >> change history is available in the VCS already and also in your IDE, so > >> anyone who needs to know how a given file has changed can go look that up. > > >> Sean > > >> On Wed, Aug 3, 2011 at 12:29 PM, octopusgrabbus > >> wrote: > > >> > Is there a preferred method for adding a Change History block to a > >> > Clojure module? I'm doing this for now: > > >> > (ns addr-verify > >> > ^{:author "Charles M. Norton", > >> > :doc "addr-verify is a small Clojure program that runs address > >> > verification through ... > > >> > Created on August 3, 2011 > >> > Change History: "} > >> > (:gen-class) > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Adding "Change History" To Clojure Modules
We have a fairly simple development environment here, not that it couldn't stand updating, but other than a consultant, I am the only developer. I need changes written directly into each file. and here is why. When I got here over seven years ago, there were well over 200 4GL modules and a smattering of C modules built into Informix's customized runner for 4GL pcode. Almost no module had comments; and almost no module had module header information. We also had no formal build. Yes, I could look things up in CVS, but I find it better to have stuff written in the header. I'm using $Log$, and it works. Thanks. On Aug 3, 5:36 pm, Sean Corfield wrote: > I think Joop meant to use the change history in your version control system > directly, rather than try to put it into the source code. > > I think the prevailing best practices these days are to _not_ duplicate > change history into source code, even thru VCS keyword substitution. The > change history is available in the VCS already and also in your IDE, so > anyone who needs to know how a given file has changed can go look that up. > > Sean > > On Wed, Aug 3, 2011 at 12:29 PM, octopusgrabbus > wrote: > > > > > > > > > Is there a preferred method for adding a Change History block to a > > Clojure module? I'm doing this for now: > > > (ns addr-verify > > ^{:author "Charles M. Norton", > > :doc "addr-verify is a small Clojure program that runs address > > verification through ... > > > Created on August 3, 2011 > > Change History: "} > > (:gen-class) -- 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: Adding "Change History" To Clojure Modules
Thanks, and I'm searching as to how to get cvs commit to write this into the module. If you know that, it would be so helpful. On Aug 3, 3:31 pm, Joop Kiefte wrote: > changelog.txt / VCS? > > 2011/8/3 octopusgrabbus : > > > > > > > > > Is there a preferred method for adding a Change History block to a > > Clojure module? I'm doing this for now: > > > (ns addr-verify > > ^{:author "Charles M. Norton", > > :doc "addr-verify is a small Clojure program that runs address > > verification through ... > > > Created on August 3, 2011 > > Change History: "} > > (:gen-class) > > . > > . > > . > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Adding "Change History" To Clojure Modules
Is there a preferred method for adding a Change History block to a Clojure module? I'm doing this for now: (ns addr-verify ^{:author "Charles M. Norton", :doc "addr-verify is a small Clojure program that runs address verification through ... Created on August 3, 2011 Change History: "} (:gen-class) . . . -- 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: Best Way To Remove vector from vector of vectors?
Got it. I'll go make up different test data; I do get back strings. Thanks. On Aug 2, 7:51 am, "Meikel Brandmeyer (kotarak)" wrote: > Hi, > > Am Dienstag, 2. August 2011 13:48:33 UTC+2 schrieb Ken Wesson: > > > What are you actually wanting to check the integers for? Being zero? > > There's a function named "zero?" for that. > > I rather suspect, that he gets back strings from his CSV code, but manually > tested with numbers. > > Sincerely > Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Best Way To Remove vector from vector of vectors?
I'm having trouble with the suggested fix (shortened function name for testing). Here is some test data: (def vv1 [[49 48 47 46 nil 1 2 3 4][5 6 7 8 9 10 11 12 13]]) (defn f1 [all-csv-rows] (let [clean-rows (vec (filter #(and (pos? (count %)) (not (cstr/ blank? (nth % 5 nil all-csv-rows) ) ] clean-rows)) This function is returning (f1 vv1) java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.CharSequence (NO_SOURCE_FILE:0) addr-verify=> cmn On Aug 1, 4:51 pm, octopusgrabbus wrote: > I'm going to give filter a shot. > > On Aug 1, 4:27 pm, Mark Rathwell wrote: > > > > > > > > > A few more things: > > > - I don't know if you want to be passing the start val to reduce in this > > case ([]), it's not doing anything here > > > - you have the arguments to > backwards. (> 0 2) in prefix is (0 > 2) in > > infix notation, so this will always return false in your code since the > > vector count will never be less than zero > > > - Any reason you can't just use filter ? > > > On Mon, Aug 1, 2011 at 4:11 PM, Meikel Brandmeyer wrote: > > > Hi, > > > > Am 01.08.2011 um 21:55 schrieb octopusgrabbus: > > > > > I get back a vector of vectors from clojure-csv/parse-csv. I want to > > > > remove vectors from that sequence based on the out come of certain > > > > tests on individual vector elements. > > > > You can't easily slice out elements from the middle of a vector. You will > > > have to reconstruct the vector. Simplest is to go the sequence route. > > > > (defn filter-parsed-csv-rows > > > [all-csv-rows] > > > (vec (filter #(and (pos? (count %)) (not (cstr/blank? (nth % 5 nil > > > all-csv-rows))) > > > > > Below, get-parsed-csv-file is called first and returns clean-csv-rows. > > > > filter-parsed-csv-rows is called with clean-csv=rows, but is not > > > > returning anything. I'm trying to figure out why. > > > > It's because you return nil when your predicate isn't fulfilled. You have > > > to return checked-row in the else branch of the if. > > > > Hope that helps. > > > > 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 -- 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: Best Way To Remove vector from vector of vectors?
I'm going to give filter a shot. On Aug 1, 4:27 pm, Mark Rathwell wrote: > A few more things: > > - I don't know if you want to be passing the start val to reduce in this > case ([]), it's not doing anything here > > - you have the arguments to > backwards. (> 0 2) in prefix is (0 > 2) in > infix notation, so this will always return false in your code since the > vector count will never be less than zero > > - Any reason you can't just use filter ? > > On Mon, Aug 1, 2011 at 4:11 PM, Meikel Brandmeyer wrote: > > Hi, > > > Am 01.08.2011 um 21:55 schrieb octopusgrabbus: > > > > I get back a vector of vectors from clojure-csv/parse-csv. I want to > > > remove vectors from that sequence based on the out come of certain > > > tests on individual vector elements. > > > You can't easily slice out elements from the middle of a vector. You will > > have to reconstruct the vector. Simplest is to go the sequence route. > > > (defn filter-parsed-csv-rows > > [all-csv-rows] > > (vec (filter #(and (pos? (count %)) (not (cstr/blank? (nth % 5 nil > > all-csv-rows))) > > > > Below, get-parsed-csv-file is called first and returns clean-csv-rows. > > > filter-parsed-csv-rows is called with clean-csv=rows, but is not > > > returning anything. I'm trying to figure out why. > > > It's because you return nil when your predicate isn't fulfilled. You have > > to return checked-row in the else branch of the if. > > > Hope that helps. > > > 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 -- 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: Best Way To Remove vector from vector of vectors?
Thanks. This does help. On Aug 1, 4:11 pm, Meikel Brandmeyer wrote: > Hi, > > Am 01.08.2011 um 21:55 schrieb octopusgrabbus: > > > I get back a vector of vectors from clojure-csv/parse-csv. I want to > > remove vectors from that sequence based on the out come of certain > > tests on individual vector elements. > > You can't easily slice out elements from the middle of a vector. You will > have to reconstruct the vector. Simplest is to go the sequence route. > > (defn filter-parsed-csv-rows > [all-csv-rows] > (vec (filter #(and (pos? (count %)) (not (cstr/blank? (nth % 5 nil > all-csv-rows))) > > > Below, get-parsed-csv-file is called first and returns clean-csv-rows. > > filter-parsed-csv-rows is called with clean-csv=rows, but is not > > returning anything. I'm trying to figure out why. > > It's because you return nil when your predicate isn't fulfilled. You have to > return checked-row in the else branch of the if. > > Hope that helps. > > 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
Best Way To Remove vector from vector of vectors?
I get back a vector of vectors from clojure-csv/parse-csv. I want to remove vectors from that sequence based on the out come of certain tests on individual vector elements. Below, get-parsed-csv-file is called first and returns clean-csv-rows. filter-parsed-csv-rows is called with clean-csv=rows, but is not returning anything. I'm trying to figure out why. (defn gen-parsed-csv-file "Returns a sequence generated by parse-csv" [file-name] (let [ data (slurp file-name) all-csv-rows(parse-csv data) clean-csv-rows (if (= 0 (count (first (last all-csv- rows (drop-last 1 all-csv-rows) all-csv-rows)])) (defn filter-parsed-csv-rows "Returns cleaned-up parsed csv rows." [all-csv-rows] (reduce (fn [checked-row one-csv-row] (if (and (> 0 (count one-csv-row)) ((not (cstr/blank? (nth one-csv-row 5 nil) (conj checked-row one-csv-row))) [] all-csv-rows)) -- 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: Where Are Clojure's (Cake') Build Steps Document
Thanks. This information is helpful. cmn On Aug 1, 10:16 am, Mark Rathwell wrote: > I don't know much about cake other than that it is basically lein with a > persistent JVM and a defines tasks differently, but: > > 1. lein uses Maven to fetch dependencies. The documentation for Maven can > be found at [1]. > > 2. I'm not sure what type of setup you are looking for in production, but if > you just want to deploy a jar, lein has a task called uberjar that will > bundle your code and all dependency code into one big jar file: > > lein uberjar > > and you run the output jar file with: > > java -jar [options] my.uber.jar > > [1]http://maven.apache.org/ > <http://maven.apache.org/> > > On Mon, Aug 1, 2011 at 8:18 AM, octopusgrabbus > wrote: > > > > > > > > > On a production system, I would like to implement less sophisticated > > build shell scripts without the benefit of having installed cake or > > its dependencies. I am using cake on my Ubuntu development > > workstation; it works well. > > > However, when Cake fetches dependencies, all that detail is hidden. > > Therefore, I am wondering where Clojure's build steps are documented, > > including fetching dependencies. > > > Many thanks. > > cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Where Are Clojure's (Cake') Build Steps Document
On a production system, I would like to implement less sophisticated build shell scripts without the benefit of having installed cake or its dependencies. I am using cake on my Ubuntu development workstation; it works well. However, when Cake fetches dependencies, all that detail is hidden. Therefore, I am wondering where Clojure's build steps are documented, including fetching dependencies. Many thanks. cmn -- 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: Libraries and build management hell
On Jul 28, 10:06 pm, Mark Rathwell wrote: > The problem with jar downloads as the default distribution method is that > non-Java people, and even plenty of Java people, seem to have problems > consistently setting classpaths correctly. Seems much more straightforward > to just have lein take care of that for you. So far, my problems have not been related to CLASSPATH, but instead revolve around understanding the differences in how different packages are built. Also, the structure of different library's build directories that I have seen on github varies quite a bit. I am building an application and only need my source in ./project_name/ src/project_name.clj, but some libraries I have seen have a project_name/project_name.clj under source. For beginners, it is a roadblock. But because of this group, the roadblock, at least for me, is temporary. > > As for complicated installation instructions, libraries meant to be used in > lein have installation instructions that generally look like this: > > [compojure "0.6.4"] > > The other alternative is to have environment package managers like Python > with easy_install and Ruby with gems. Then you need to bring virtualenv or > Ruby version manager into the picture to use different versions of the same > library in different apps. The Java world has tended towards dependencies > being coupled with the application, rather than the environment. There are > good arguments for both sides, but either way, I don't think it can get much > easier than lein. > > - Mark > > On Thu, Jul 28, 2011 at 5:23 PM, Michal B wrote: > > Why does it have to be so complicated to use libraries? > > > To use libraries, you need to learn how to operate half a dozen build tools > > and git because each library author distributes their library differently. > > If figuring out how to install an IDE with clojure wasn't bad enough, now > > you need to figure out how to install and use each of the tools with it. > > > I'm not saying build tools are useless, on the contrary. It's just that > > most of the time, we want to sling two or three libraries together and code. > > Right? There is no need to start a project with a bunch of template files > > and an elaborate directory structure and to start configuring dependencies > > and to rely on some magic happening that makes your program run. > > > I think we over-engineered the build process to support the big projects > > and forgot the common case. Most projects are simple. > > > Let's remove this incidental complexity by returning to simplicity. Keep > > the build tools for the heavyweights and get back in touch with your > > libraries. > > > Instead of having a complicated installation guide for your library, have a > > Download section in your site. Have there a link to the latest stable > > version of your library as a jar file or, if necessary, a zip file with your > > jar and and all the necessary dependency jars (sane library authors won't > > mind). For a zip, shortly describe what's in it - library names and > > versions, and links to their sites. That's it. > > > I think most JVM users know or can quickly figure out how to take jars and > > put them in their project's classpath. It's simple to do with all IDEs (or > > without one) and there is no need to learn or install additional software or > > edit configuration files. Starter scripts should include in the classpath > > all jars in the current directory or jars/ directory by default. > > > Instead of managing libraries inside a dependencies file, you do it > > directly with the jar files. If the project gets too big, bring in the build > > tools. > > > What are your thoughts on this issue? > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure.contrib.command-line
Thanks. This fixed it. On Jul 29, 9:45 am, gaz jones wrote: > it lives on github:http://github.com/clojure/tools.cli > like all the new contrib libs, to use it in a project you need to add > it to your dependencies: > > :dependencies [[org.clojure/clojure "1.2.1"] > [org.clojure/tools.cli "0.1.0"]] > > On Fri, Jul 29, 2011 at 7:56 AM, octopusgrabbus > > > > > > > > wrote: > > > On Jul 28, 7:24 pm, Anthony Grimes wrote: > >> command-line is deprecated in favor of tools.cli > >> now.http://github.com/clojure/tools.cli > > > Where is the repository located? > > > (ns addr-verify > > (:gen-class) > > (:require [clojure.tools.cli :only (cli optional)]) > > . > > . > > . > > results in this error: > > > clojure.lang.Compiler$CompilerException: > > java.io.FileNotFoundException: Could not locate clojure/tools/ > > cli__init.class or clojure/tools/cli.clj on classpath: > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Building cli
This fixed it. Thanks Gaz Jones: :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/tools.cli "0.1.0"]] On Jul 29, 10:01 am, octopusgrabbus wrote: > I have downloaded the source to tools.cli and built it with maven. > I've put the jar out in /usr/share/java, and created a link to it: > > sudo ln -s /usr/share/java/tools.cli-0.1.0.jar /usr/share/java/ > tools.cli.jar. > > I am getting this error on compile > > Caused by: clojure.lang.Compiler$CompilerException: > java.io.FileNotFoundException: Could not locate clojure/tools/ > cli__init.class or clojure/tools/cli.clj on classpath: > (addr_verify.clj:2) > > (ns addr-verify > (:gen-class) > (:require [clojure.string :as cstr]) > (:require [clojure.contrib.str-utils :as ustr]) > (:require [clj-http.client :as client]) > (:use clojure-csv.core) > (:use [clojure.tools.cli]) > (:import java.util.Date) > (:import java.lang.Thread) > ) > > I've looked at how this is "included' in both cli's test directory and > on the internet, and I'm still getting the error. > Any help would be appreciated. > tnx > cmn -- 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
Building cli
I have downloaded the source to tools.cli and built it with maven. I've put the jar out in /usr/share/java, and created a link to it: sudo ln -s /usr/share/java/tools.cli-0.1.0.jar /usr/share/java/ tools.cli.jar. I am getting this error on compile Caused by: clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate clojure/tools/ cli__init.class or clojure/tools/cli.clj on classpath: (addr_verify.clj:2) (ns addr-verify (:gen-class) (:require [clojure.string :as cstr]) (:require [clojure.contrib.str-utils :as ustr]) (:require [clj-http.client :as client]) (:use clojure-csv.core) (:use [clojure.tools.cli]) (:import java.util.Date) (:import java.lang.Thread) ) I've looked at how this is "included' in both cli's test directory and on the internet, and I'm still getting the error. Any help would be appreciated. tnx cmn -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure.contrib.command-line
On Jul 28, 7:24 pm, Anthony Grimes wrote: > command-line is deprecated in favor of tools.cli > now.http://github.com/clojure/tools.cli Where is the repository located? (ns addr-verify (:gen-class) (:require [clojure.tools.cli :only (cli optional)]) . . . results in this error: clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate clojure/tools/ cli__init.class or clojure/tools/cli.clj on classpath: -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure.contrib.command-line
Thanks. I'll switch over. On Jul 28, 7:24 pm, Anthony Grimes wrote: > command-line is deprecated in favor of tools.cli > now.http://github.com/clojure/tools.cli -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
clojure.contrib.command-line
Are there any command-line examples or documentation other than what's up on clojure.org or ClojureDocs? I'm using (defn -main [& args] (with-command-line args "Get csv file name" [[in-file-name ".csv input file name" "resultset.csv" ]] [[in-file-name ".csv input file name" 1]] (println "in-file-name:", in-file-name) If I specify a file name it does not get used. Only resultset.csv is used. tnx cmn -- 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: Cake CLASSPATH Error
Thanks. It appears it was set up correctly all along, but didn't have the extra directories created by cake new. On Jul 27, 3:09 pm, Mark Rathwell wrote: > Namespace file locations start from the src directory, in your project > directory. So, a file that declares namespace addr-verify should be located > in src/addr_verify.clj. A file that declares namespace > addr-verify.addr-verify would be found in src/addr_verify/addr_verify.clj. > > On Wed, Jul 27, 2011 at 2:42 PM, octopusgrabbus > wrote: > > > > > > > > > I originally had a project set up that built correctly, but the > > project directories had not been set up with cake new. > > > I saved my project and main files; created a new project tree with > > cake new addr_verify; and then replaced project.clj and > > addr_verify.clj with the working files. Before, addr_verify.clj needed > > to go into addr_verify/src, and this time it went into addr_verify/src/ > > addr_verify. > > > Here is my CLASSPATH /usr/share/java > > > I'm getting this error on cake compile and am not sure how to correct > > the error or what to add. I would appreciate help. > > > java.lang.RuntimeException: java.io.FileNotFoundException: Could not > > locate addr_verify__init.class or addr_verify.clj on classpath: > > > this is project.clj > > (defproject util-str "0.0.1-SNAPSHOT" > > :description "This provides some string handling routines not found > > directly in Clojure's libraries." > > :dependencies [[org.clojure/clojure "1.2.1"] > > [org.clojure/clojure-contrib "1.2.0"] > > [clojure-csv/clojure-csv "1.2.4"] > > [clj-http "0.1.3"]]) > > > this is the first few lines of addr_verify.clj > > > (ns addr-verify > > (:gen-class) > > (:use clojure.contrib.command-line) > > (:require [clojure.string :as cstr]) > > (:require [clojure.contrib.str-utils :as ustr]) > > (:require [clj-http.client :as client]) > > (:import java.util.Date) > > (:import java.lang.Thread) > > (:use clojure-csv.core)) > > > (def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", > > "ZIP", "YR", "BILL_NO", "BILL_TYPE"] ) > > (def accumail-url "http://MailVerify/Lookup/chkAddr.asp";) > > > Thanks. cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Cake CLASSPATH Error
I originally had a project set up that built correctly, but the project directories had not been set up with cake new. I saved my project and main files; created a new project tree with cake new addr_verify; and then replaced project.clj and addr_verify.clj with the working files. Before, addr_verify.clj needed to go into addr_verify/src, and this time it went into addr_verify/src/ addr_verify. Here is my CLASSPATH /usr/share/java I'm getting this error on cake compile and am not sure how to correct the error or what to add. I would appreciate help. java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate addr_verify__init.class or addr_verify.clj on classpath: this is project.clj (defproject util-str "0.0.1-SNAPSHOT" :description "This provides some string handling routines not found directly in Clojure's libraries." :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/clojure-contrib "1.2.0"] [clojure-csv/clojure-csv "1.2.4"] [clj-http "0.1.3"]]) this is the first few lines of addr_verify.clj (ns addr-verify (:gen-class) (:use clojure.contrib.command-line) (:require [clojure.string :as cstr]) (:require [clojure.contrib.str-utils :as ustr]) (:require [clj-http.client :as client]) (:import java.util.Date) (:import java.lang.Thread) (:use clojure-csv.core)) (def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", "ZIP", "YR", "BILL_NO", "BILL_TYPE"] ) (def accumail-url "http://MailVerify/Lookup/chkAddr.asp";) Thanks. cmn -- 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: cake create project / setup instructions
cake new does work. I had run cake new in the wrong place before, so I am rebuilding the tree. Problem solved for now. On Jul 27, 1:13 pm, octopusgrabbus wrote: > I found the new command for cake, but I get this error, so I'm a > little confused as to what's going on. cake builds otherwise. > > cnorton@steamboy:~/projects/clojure$ cake new addr_verify > unknown task: new > > On Jul 27, 8:50 am, octopusgrabbus wrote: > > > > > > > > > Before getting too far along, I'd like to set up my project the way > > I've seen other projects' configurations, like clj-http and clojure- > > csv. I can build my project, but it is not set up in the standard way. > > > I am using cake, but cannot find instructions on configuring and then > > creating the project from scratch. > > > tnx > > cmn -- 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: cake create project / setup instructions
I found the new command for cake, but I get this error, so I'm a little confused as to what's going on. cake builds otherwise. cnorton@steamboy:~/projects/clojure$ cake new addr_verify unknown task: new On Jul 27, 8:50 am, octopusgrabbus wrote: > Before getting too far along, I'd like to set up my project the way > I've seen other projects' configurations, like clj-http and clojure- > csv. I can build my project, but it is not set up in the standard way. > > I am using cake, but cannot find instructions on configuring and then > creating the project from scratch. > > tnx > cmn -- 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
cake create project / setup instructions
Before getting too far along, I'd like to set up my project the way I've seen other projects' configurations, like clj-http and clojure- csv. I can build my project, but it is not set up in the standard way. I am using cake, but cannot find instructions on configuring and then creating the project from scratch. tnx cmn -- 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: Need Help Parsing Clojure Strings
Thanks for the suggestion. I will try this tomorrow and report back. On Jul 25, 3:46 pm, Islon Scherer wrote: > Do you want something like: > (vec (.split some-string "\\|")) > > (vec (.split "AT|1 Kenilworth Rd||Soapville|ZA|99901-7505|Option value=A ==> > Normal street matchOption value=T ==> ZIP+4 corrected|013|C065|" "\\|")) > => ["AT" "1 Kenilworth Rd" "" "Soapville" "ZA" "99901-7505" "Option value=A > ==> Normal street matchOption value=T ==> ZIP+4 corrected" "013" "C065"] -- 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: Need Help Parsing Clojure Strings
Thanks. I finally got part of my problem when I changed the regex to #"\d\d\d\d\d-\d\d\d\d" to match the zip-zip4, and when that disappeared, I realized what was going on. On Jul 25, 3:51 pm, Tassilo Horn wrote: > octopusgrabbus writes: > > Hi! > > > > > What I want to do is take the zip-zip4 field, split the zip and zip 4 > > apart, and add them as separate fields right after state ZA. I want to > > do some other things too (like remove from Option value... through > > 013), but that's the next step. > > > This function > > > (defn rearrange-accumail-seq > > "Fixes up AccuMail sequence, so we have the right data, and it's > > in the correct order." > > [in-str] > > (let [s1 (cstr/split in-str #"^\w*\|\w*\|\w*\|\w*\|")] > > s1)) > > > does not do what I expect it to. That is I cannot find first and next > > in the vector of splits returned. > > `split' expects a regex that matches the *separator*. > > (clojure.string/split "foo|bar|baz" #"\|") > ==> ["foo" "bar" "baz"] > > Then you can take the compontents of the resulting vector and shuffle > them to your likings. > > Bye, > Tassilo -- 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
Need Help Parsing Clojure Strings
I have a web application that returns data that is pipe-delimited and looks like this: AT|1 Kenilworth Rd||Soapville|ZA|99901-7505|Option value=A ==> Normal street matchOption value=T ==> ZIP+4 corrected|013|C065| What I want to do is take the zip-zip4 field, split the zip and zip 4 apart, and add them as separate fields right after state ZA. I want to do some other things too (like remove from Option value... through 013), but that's the next step. This function (defn rearrange-accumail-seq "Fixes up AccuMail sequence, so we have the right data, and it's in the correct order." [in-str] (let [s1 (cstr/split in-str #"^\w*\|\w*\|\w*\|\w*\|")] s1)) does not do what I expect it to. That is I cannot find first and next in the vector of splits returned. [AT|1 Kenilworth Rd||Soapville|ZA|99901-7505|Option value=A ==> Normal street matchOption value=T ==> ZIP+4 corrected|013|C065|] Should I be using Java string parsing directly, or am I missing something basic? Thanks. cmn -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to Return Vector of Vectors
On Jul 21, 10:15 pm, Ken Wesson wrote: > On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson wrote: > > On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus > > wrote: > >> And do you have a suggestion for a functional way? Is all-csv-rows being re-bound with the results of [] and then returned as the function's value? And again, thanks. This is exactly what I was looking for. (defn ret-params "Generates all q-parameters and returns them in a vector of vectors." [all-csv-rows] (reduce (fn [param-vec one-full-csv-row] (let [q-param (zipmap accumail-url-keys one-full-csv-row) accu-q-param (first (rest (split-at 3 q-param))) billing-param (first (split-at 3 q-param))] (conj param-vec [accu-q-param billing-param]))) [] all-csv-rows)) > > > Yes. Change > > > (doseq [one-full-csv-row all-csv-rows] > > (let [accumail-csv-row one-full-csv-row > > q-param (zipmap accumail-url-keys accumail-csv-row) > > accu-q-param (first (rest (split-at 3 q-param))) > > billing-param (first (split-at 3 q-param))] > > (conj param-vec accu-q-param billing-param))) > > > to > > > (reduce > > (fn [one-full-csv-row] > > (let [q-param (zipmap accumail-url-keys one-full-csv-row) > > accu-q-param (first (rest (split-at 3 q-param))) > > billing-param (first (split-at 3 q-param))] > > [accu-q-param billing-param])) > > [] > > all-csv-rows) > > Er, that's weird. I don't know what happened there. Obviously that should be > > (reduce > (fn [param-vec one-full-csv-row] > (let [q-param (zipmap accumail-url-keys one-full-csv-row) > accu-q-param (first (rest (split-at 3 q-param))) > billing-param (first (split-at 3 q-param))] > (conj param-vec [accu-q-param billing-param]))) > [] > all-csv-rows) > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to Return Vector of Vectors
Thanks for the example. On Jul 21, 10:15 pm, Ken Wesson wrote: > On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson wrote: > > On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus > > wrote: > >> And do you have a suggestion for a functional way? > > > Yes. Change > > > (doseq [one-full-csv-row all-csv-rows] > > (let [accumail-csv-row one-full-csv-row > > q-param (zipmap accumail-url-keys accumail-csv-row) > > accu-q-param (first (rest (split-at 3 q-param))) > > billing-param (first (split-at 3 q-param))] > > (conj param-vec accu-q-param billing-param))) > > > to > > > (reduce > > (fn [one-full-csv-row] > > (let [q-param (zipmap accumail-url-keys one-full-csv-row) > > accu-q-param (first (rest (split-at 3 q-param))) > > billing-param (first (split-at 3 q-param))] > > [accu-q-param billing-param])) > > [] > > all-csv-rows) > > Er, that's weird. I don't know what happened there. Obviously that should be > > (reduce > (fn [param-vec one-full-csv-row] > (let [q-param (zipmap accumail-url-keys one-full-csv-row) > accu-q-param (first (rest (split-at 3 q-param))) > billing-param (first (split-at 3 q-param))] > (conj param-vec [accu-q-param billing-param]))) > [] > all-csv-rows) > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to Return Vector of Vectors
And do you have a suggestion for a functional way? On Jul 21, 8:05 pm, Islon Scherer wrote: > Simple: conj doesn't mutate the vector, it returns a new vector. > Clojure is a (mostly) immutable language, you're trying to solve the > problem in a imperative way, you should solve it in a functional way. > > On Jul 21, 7:48 pm, octopusgrabbus wrote: > > > (def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", > > "ZIP", "YR", "BILL_NO", BILL_TYPE"]) > > > (defn ret-params > > "Generates all q-parameters and returns them in a vector of > > vectors." > > [all-csv-rows] > > (let [param-vec [[]] ] > > (doseq [one-full-csv-row all-csv-rows] > > (let [accumail-csv-row one-full-csv-row > > q-param (zipmap accumail-url-keys accumail-csv-row) > > accu-q-param (first (rest (split-at 3 q-param))) > > billing-param (first (split-at 3 q-param))] > > (conj param-vec accu-q-param billing-param))) > > param-vec)) > > > I combine some internal data with each vector returned from clojure- > > csv's parse-csv. I want to return all that in a new vector of vectors, > > but param-vec is empty. What am I doing wrong? > > > tnx > > cmn -- 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
How to Return Vector of Vectors
(def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", "ZIP", "YR", "BILL_NO", BILL_TYPE"]) (defn ret-params "Generates all q-parameters and returns them in a vector of vectors." [all-csv-rows] (let [param-vec [[]] ] (doseq [one-full-csv-row all-csv-rows] (let [accumail-csv-row one-full-csv-row q-param (zipmap accumail-url-keys accumail-csv-row) accu-q-param (first (rest (split-at 3 q-param))) billing-param (first (split-at 3 q-param))] (conj param-vec accu-q-param billing-param))) param-vec)) I combine some internal data with each vector returned from clojure- csv's parse-csv. I want to return all that in a new vector of vectors, but param-vec is empty. What am I doing wrong? tnx cmn -- 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: Being able to use blank?
Thanks. You're right. (:require [clojure.contrib.string :as cstr]) ; str already defined On Jul 21, 3:16 pm, Islon Scherer wrote: > I think it's just a sintax problem. > > (ns test-csv > ... > (:require [clojure.string :as str])) -- 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
Being able to use blank?
What is the proper syntax to be able to use blank? ? I've tried a bunch of things in the docs, but either the :require syntax is bad, or I get a Java exception saying blank? not recognized. Method 1 - (ns test-csv (:gen-class) (:use clojure.contrib.command-line) (:use clojure-csv.core) (:require '[clojure.string :as str])) java.lang.RuntimeException: java.lang.Exception: lib names inside prefix lists must not contain periods (test_csv.clj:2) Method 2 - (ns test-csv (:gen-class) (:use clojure.contrib.command-line) (:use clojure-csv.core) (:require clojure.contrib.string)) [compile] Compiling namespace test-csv error evaluating: ((compile-stale source-path compile-path)) java.lang.RuntimeException: java.lang.Exception: Unable to resolve symbol: blank? in this context (test_csv.clj:16) -- 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: Constructing clj-http Get Query
That's it. Thanks. user=> (client/get "http://MailVerify/Lookup/chkAddr.asp"; {:query- params {"CA" "1", "STREET" "909 FROTHINGVALE ST", "STREET2" " ", "CITY" "MADEUPVILLE", "STATE" "MA", "ZIP" "02474"}}) On Jul 20, 10:49 am, Mark Rathwell wrote: > You need to specify the base url string as the first argument, and the map > is an optional second argument: > > (client/get "http://..."; {:query-params {"CA" ...}}) > > On Wed, Jul 20, 2011 at 10:46 AM, octopusgrabbus > wrote: > > > > > > > > > On Jul 20, 10:26 am, Ulises wrote: > > > try passing a map such as {:query-params {"CA" ca, "street" street ...}}. > > > I've tried a few variations of the following but with no luck. > > > (client/get {:query-params {"CA" "1", "STREET" "625 OX ST", "STREET2" > > " ", "CITY" "SPRINGFIELD", "ZIP" "9"}}) > > java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot > > be cast to java.lang.String (NO_SOURCE_FILE:0) > > > > > (require '[clj-http.client :as client]) > > > > (defn make-url [ca street-1 street-2 city state zip] > > > > (let > > > > [url " > >http://MailVerify/Lookup/chkAddr.asp?CA=%s&street=%s&STREET2=%s&CITY=...";] > > > > (format url ca street-1 street-2 city state zip))) > > > > (client/get (make-url "xxx" "123 Some St" "Apt 24" "New York" "NY" > > "10026")) > > > > > On Wed, Jul 20, 2011 at 10:09 AM, octopusgrabbus < > > octopusgrab...@gmail.com> > > > > wrote: > > > > >> I've been looking at the examples for clj-http. I'm trying to map the > > > >> perl string (below) to clj-http's parameters. > > > > >> $gInputUrl = "http://MailVerify/Lookup/chkAddr.asp"; . "?CA=" . $gCa . > > > >> "&STREET=" . $gAddrSubst1 . "&STREET2=" . $gAddrSubst2 . "&CITY=" . > > > >> $gCity . "&STATE=" . $gState . "&ZIP=" . $zip4Local; > > > > >> Could someone point me to a similar get string? > > > > >> Thanks. > > > >> cmn > > > > >> -- > > > >> You received this message because you are subscribed to the Google > > > >> Groups "Clojure" group. > > > >> To post to this group, send email to clojure@googlegroups.com > > > >> Note that posts from new members are moderated - please be patient > > with > > > >> your first post. > > > >> To unsubscribe from this group, send email to > > > >> clojure+unsubscr...@googlegroups.com > > > >> For more options, visit this group at > > > >>http://groups.google.com/group/clojure?hl=en > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Clojure" group. > > > > To post to this group, send email to clojure@googlegroups.com > > > > Note that posts from new members are moderated - please be patient with > > your > > > > first post. > > > > To unsubscribe from this group, send email to > > > > clojure+unsubscr...@googlegroups.com > > > > For more options, visit this group at > > > >http://groups.google.com/group/clojure?hl=en > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- 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: Constructing clj-http Get Query
On Jul 20, 10:26 am, Ulises wrote: > try passing a map such as {:query-params {"CA" ca, "street" street ...}}. > I've tried a few variations of the following but with no luck. (client/get {:query-params {"CA" "1", "STREET" "625 OX ST", "STREET2" " ", "CITY" "SPRINGFIELD", "ZIP" "9"}}) java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.String (NO_SOURCE_FILE:0) > > > > > > > > > > > (require '[clj-http.client :as client]) > > (defn make-url [ca street-1 street-2 city state zip] > > (let > > [url "http://MailVerify/Lookup/chkAddr.asp?CA=%s&street=%s&STREET2=%s&CITY=...";] > > (format url ca street-1 street-2 city state zip))) > > (client/get (make-url "xxx" "123 Some St" "Apt 24" "New York" "NY" "10026")) > > > On Wed, Jul 20, 2011 at 10:09 AM, octopusgrabbus > > wrote: > > >> I've been looking at the examples for clj-http. I'm trying to map the > >> perl string (below) to clj-http's parameters. > > >> $gInputUrl = "http://MailVerify/Lookup/chkAddr.asp"; . "?CA=" . $gCa . > >> "&STREET=" . $gAddrSubst1 . "&STREET2=" . $gAddrSubst2 . "&CITY=" . > >> $gCity . "&STATE=" . $gState . "&ZIP=" . $zip4Local; > > >> Could someone point me to a similar get string? > > >> Thanks. > >> cmn > > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Clojure" group. > >> To post to this group, send email to clojure@googlegroups.com > >> Note that posts from new members are moderated - please be patient with > >> your first post. > >> To unsubscribe from this group, send email to > >> clojure+unsubscr...@googlegroups.com > >> For more options, visit this group at > >>http://groups.google.com/group/clojure?hl=en > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with your > > first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Constructing clj-http Get Query
Thanks. That creates a great URL string, but when passed into (client/ get gets this error: java.lang.IllegalArgumentException (NO_SOURCE_FILE:0) cmn On Jul 20, 10:24 am, Mark Rathwell wrote: > (require '[clj-http.client :as client]) > > (defn make-url [ca street-1 street-2 city state zip] > (let [url > "http://MailVerify/Lookup/chkAddr.asp?CA=%s&street=%s&STREET2=%s&CITY=... > "] > (format url ca street-1 street-2 city state zip))) > > (client/get (make-url "xxx" "123 Some St" "Apt 24" "New York" "NY" "10026")) > > On Wed, Jul 20, 2011 at 10:09 AM, octopusgrabbus > wrote: > > > > > > > > > I've been looking at the examples for clj-http. I'm trying to map the > > perl string (below) to clj-http's parameters. > > > $gInputUrl = "http://MailVerify/Lookup/chkAddr.asp"; . "?CA=" . $gCa . > > "&STREET=" . $gAddrSubst1 . "&STREET2=" . $gAddrSubst2 . "&CITY=" . > > $gCity . "&STATE=" . $gState . "&ZIP=" . $zip4Local; > > > Could someone point me to a similar get string? > > > Thanks. > > cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Constructing clj-http Get Query
I've been looking at the examples for clj-http. I'm trying to map the perl string (below) to clj-http's parameters. $gInputUrl = "http://MailVerify/Lookup/chkAddr.asp"; . "?CA=" . $gCa . "&STREET=" . $gAddrSubst1 . "&STREET2=" . $gAddrSubst2 . "&CITY=" . $gCity . "&STATE=" . $gState . "&ZIP=" . $zip4Local; Could someone point me to a similar get string? Thanks. cmn -- 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: Fixing Java Apache Class error
On Jul 20, 9:45 am, Islon Scherer wrote: > Mark is right, you should use lein (or cake) repl instead of trying to run > clojure on command line. Thanks. There is no reason I can't do that. It works. -- 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: Fixing Java Apache Class error
Same problem. I'm starting Clojure like this, and have rebuilt clj- http with cake deps exec java -cp /usr/share/java/jline.jar:/usr/share/java/clojure.jar:/ usr/share/java/clojure-contrib.jar:/usr/share/java/commons- logging-1.1.1.jar:/home/cnorton/git_build/clj-http/clj- http-0.1.3.jar"$extra_classpath" clojure.main "$@" On Jul 20, 9:31 am, Islon Scherer wrote: > It seems like you didn't put the apache HTTP client jars in your path. Are > you using leiningen? If so you only need to run "lein deps" and it will > download the dependencies. -- 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
Fixing Java Apache Class error
When I do this: Clojure 1.2.1 user=> (require '[clj-http.client :as client]) I get this error: java.lang.ClassNotFoundException: org.apache.http.HttpRequest (core.clj:1) Does this mean I'm missing a java component? Thanks. cmn -- 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: Fixing Java Apache Class error
I've already tried this, and it did not fix the problem. http://www.java-samples.com/showtutorial.php?tutorialid=674 On Jul 20, 9:21 am, octopusgrabbus wrote: > When I do this: > > Clojure 1.2.1 > user=> (require '[clj-http.client :as client]) > > I get this error: > > java.lang.ClassNotFoundException: org.apache.http.HttpRequest > (core.clj:1) > > Does this mean I'm missing a java component? > > Thanks. > cmn -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Books
On Jul 19, 1:06 am, Sean Corfield wrote: > On Mon, Jul 18, 2011 at 8:01 PM, Felix Filozov wrote: > > Clojure in Action - http://www.manning.com/rathore/ And there is also an upcoming web course based on this book. http://codelesson.com/courses/view/introduction-to-clojure > > Targeting Clojure 1.2.0. Nice introduction, good, practical examples. > > > Programming Clojure - http://pragprog.com/book/shcloj/programming-clojure > > Aaron Bedra et al are working on a new edition of this, bringing it up > to Clojure 1.3.0. The original targets Clojure 1.1 (I think? Or 1.0?). > I don't have this book. > > > Practical Clojure - http://www.apress.com/9781430272311 > > Targeting Clojure 1.2.0. I don't have this book. > > > Joy of Clojure (not for beginners) - http://joyofclojure.com/ > > Not for beginners but an excellent "why" book! I love this book - I > keep re-reading it. > > Also: > > Clojure Programming -http://oreilly.com/catalog/0636920013754 > > Currently in Rough Cuts. Targeting Clojure 1.3.0. Really enjoying this too. > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View --http://corfield.org/ > World Singles, LLC. --http://worldsingles.com/ > Railo Technologies, Inc. --http://www.getrailo.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Please stand firm against Steve Yegge's "yes language" push
Thanks. On Jul 17, 5:52 pm, Sean Corfield wrote: > On Sun, Jul 17, 2011 at 10:59 AM, octopusgrabbus > > wrote: > > Are Steve Yegge's comments blogged/written anywhere? > > Googling is your friend -- search for: > > steve yegge clojure yes language > > and it turns up the original thread as the second result: > > http://groups.google.com/group/seajure/browse_thread/thread/18baa18ff... > > This thread in which we are participating is the #1 result for that > query on Google, BTW. > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View --http://corfield.org/ > World Singles, LLC. --http://worldsingles.com/ > Railo Technologies, Inc. --http://www.getrailo.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Please stand firm against Steve Yegge's "yes language" push
Are Steve Yegge's comments blogged/written anywhere? The last post I could find on his blog http://steve-yegge.blogspot.com/ was about Haskel and written 12/1/2010. Thanks. cmn On Jul 1, 3:59 pm, James Keats wrote: > Hi all. I've been looking at Clojure for the past month, having had a > previous look at it a couple of years ago and then moved on to other > things only to return to it now. > > Over the past decade I have looked at many languages and many ways of > doing things. People may say this language or that language is > "general purpose", but the fact remains that languages have their > niches in which they excel and beyond which it'd be foolish to > venture. > > Clojure should not attempt be a "mass success" language or worry about > its Tiobe index ranking. > > Clojure, the way I see it, is most suitable for the advanced > independent developer. It is a language in the image of its creator, > Rich Hickey. It's not a language for the factory hen. It won't become > the next Java. Java already fills that niche, and despite what some > may say, I don't see it going away anytime soon. > > I don't feel Clojure needs to "grow" - in terms of size of language. > In fact it would worry me enormously if Clojure's path is to "grow" in > size. It is fundamentally unsuited for that. If anything I wish for it > to shrink even further and further. > > A Rich Hickey's quote comes to mind: > • (paraphrased) "Most Clojure programmers go through an arc. First > they think “eww, Java” and try to hide all the Java. Then they think > “ooh, Java” and realize that Clojure is a powerful way to write Java > code" > and "As I've said in my talks, most Clojure users go from "eww, Java > libs" to "ooh, Java libs", leveraging the fact there there is already > a lib for almost anything they need to do. And using the lib is > completely transparent, idiomatic and wrapper free." - Google verbatim > for sources. > > Whereas when Steve Yegge writes: "which means that everyone (including > me!) who is porting Java code to Clojure (which, by golly, is a good > way to get a lot of people using Clojure) is stuck having to rework > the code semantically rather than just doing the simplest possible > straight port. The more they have to do this, the more you're going > to shake users off the tree." all I could think on reading this is > "horror, horror, oh God, horror!!!; he really doesn't get it". First, > he shouldn't be porting Java code to clojure, Second, Clojure IS > fundamentally different from Java, and third, such said users who > don't want to touch Java should not touch Clojure. > > Clojure shouldn't worry about growing; java already has innumerable > libs. Clojure, imho, should continue its - what I would dub - > "middleware begone!" path, in which it'd provide an end-to-end, down- > to-the-metal comprehensible system that an individual developer can > get his head round and know exactly what's happening with his code and > its environment here and everywhere. > > I could write more, but I have to run. Regards. > J. -- 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: Local bindings w/o let
I have another question about max. Is there an advantage if this were re-written with repl? On Jul 10, 7:18 pm, Jonathan Fischer Friberg wrote: > There's no interfaces, that's the function definition. > > define function max > (defn max > > attach docstring > "Returns the greatest of the nums." > > attach metadata > {:added "1.0"} > > if max is called with one argument, use this function definition > ([x] x) > > if max is called with two arguments, use this function definition > ([x y] (if (> x y) x y)) > > if max is called with more than two arguments, use this function definition > ([x y & more] > (reduce max (max x y) more))) > ___ > > As you can see, y is introduced in one of the functions definitions. > Also > see:http://clojure.org/special_forms#Special%20Forms--(fn%20name?%20[params*%20]%20exprs*)<http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20[params*%20]%20exprs*%29> > andhttp://clojure.org/metadata > > Jonathan > > On Sun, Jul 10, 2011 at 11:44 PM, octopusgrabbus > wrote: > > > For Question 1 this is an example of multiple interfaces. Got it. > > > On Jul 10, 5:42 pm, octopusgrabbus wrote: > > > From Clojure api for max > > > > (defn max > > > "Returns the greatest of the nums." > > > {:added "1.0"} > > > ([x] x) > > > ([x y] (if (> x y) x y)) > > > ([x y & more] > > > (reduce max (max x y) more))) > > > > Question 1: Why can y be introduced as a local binding without a let? > > > > Question 2: What is the map {:added "1.0"} doing? > > > > Thanks. > > > cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Local bindings w/o let
If the function is called with one argument, what Clojure language rule allows x to appear outside the vector brackets? On Jul 10, 7:18 pm, Jonathan Fischer Friberg wrote: > There's no interfaces, that's the function definition. > > define function max > (defn max > > attach docstring > "Returns the greatest of the nums." > > attach metadata > {:added "1.0"} > > if max is called with one argument, use this function definition > ([x] x) > > if max is called with two arguments, use this function definition > ([x y] (if (> x y) x y)) > > if max is called with more than two arguments, use this function definition > ([x y & more] > (reduce max (max x y) more))) > ___ > > As you can see, y is introduced in one of the functions definitions. > Also > see:http://clojure.org/special_forms#Special%20Forms--(fn%20name?%20[params*%20]%20exprs*)<http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20[params*%20]%20exprs*%29> > andhttp://clojure.org/metadata > > Jonathan > > On Sun, Jul 10, 2011 at 11:44 PM, octopusgrabbus > wrote: > > > For Question 1 this is an example of multiple interfaces. Got it. > > > On Jul 10, 5:42 pm, octopusgrabbus wrote: > > > From Clojure api for max > > > > (defn max > > > "Returns the greatest of the nums." > > > {:added "1.0"} > > > ([x] x) > > > ([x y] (if (> x y) x y)) > > > ([x y & more] > > > (reduce max (max x y) more))) > > > > Question 1: Why can y be introduced as a local binding without a let? > > > > Question 2: What is the map {:added "1.0"} doing? > > > > Thanks. > > > cmn > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Local bindings w/o let
For Question 1 this is an example of multiple interfaces. Got it. On Jul 10, 5:42 pm, octopusgrabbus wrote: > From Clojure api for max > > (defn max > "Returns the greatest of the nums." > {:added "1.0"} > ([x] x) > ([x y] (if (> x y) x y)) > ([x y & more] > (reduce max (max x y) more))) > > Question 1: Why can y be introduced as a local binding without a let? > > Question 2: What is the map {:added "1.0"} doing? > > Thanks. > cmn -- 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
Local bindings w/o let
>From Clojure api for max (defn max "Returns the greatest of the nums." {:added "1.0"} ([x] x) ([x y] (if (> x y) x y)) ([x y & more] (reduce max (max x y) more))) Question 1: Why can y be introduced as a local binding without a let? Question 2: What is the map {:added "1.0"} doing? Thanks. cmn -- 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: Confused about sequential definition
Thank you for the explanations. I saw sequential in an example out on the web. At first, I thought it had something to do with the ordering of a sequence's elements. cmn On Jul 7, 5:22 pm, Mark Rathwell wrote: > What it means exactly is that there is an interface called Sequential > (defined > inhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/S...) > that some other interfaces and abstract classes implement or extend, and > some clojure data structures that you use implement or extend those, thereby > implementing the Sequential interface, and so instances of those data > structures will return true for this function. > > What it means practically, is that the data structure is seqential, like a > list or vector, and not like a map. Depending on what you are wanting to > use it for, there may be a better function to consider. > > If you want to explore the relationships in the language, some people seem > to like Clojure Atlas:http://www.clojureatlas.com/ > > <http://www.clojureatlas.com/> > > On Thu, Jul 7, 2011 at 4:48 PM, octopusgrabbus > wrote: > > > > > > > > > What does this mean exactly? > > > sequential? > > function > > > Usage: (sequential? coll) > > > Returns true if coll implements Sequential > > > from > >http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/... > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Print Friendly (For PDF) Version of Clojure API
Is there a printer-friendly version of the Clojure API? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/identity -- 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
Confused about sequential definition
What does this mean exactly? sequential? function Usage: (sequential? coll) Returns true if coll implements Sequential from http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/sequential -- 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: Avoiding nils
Many thanks. I've clearly got to get better acquainted with various functions. On Jul 7, 4:30 pm, Allen Johnson wrote: > On Thu, Jul 7, 2011 at 4:27 PM, octopusgrabbus > wrote: > > This code > > > (defn ret-odd > > [seq-val] > > (if (not (nil? seq-val)) > > (if (odd? seq-val) > > seq-val))) > > > (def my-seq '(1 2 3 4 5 6 7 8 9)) > > > (map ret-odd my-seq) > > > finds the odd numbers, but also returns nil. How do I find just the > > odd numbers? > > (filter odd? my-seq) > > > > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Avoiding nils
This code (defn ret-odd [seq-val] (if (not (nil? seq-val)) (if (odd? seq-val) seq-val))) (def my-seq '(1 2 3 4 5 6 7 8 9)) (map ret-odd my-seq) finds the odd numbers, but also returns nil. How do I find just the odd numbers? Thanks. cmn -- 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: Please stand firm against Steve Yegge's "yes language" push
As mundane as municipal billing sounds, there are actually some instances using 3rd party Windows based address verification (SmartSoft USA's Accumail) while bills are being loaded (before generating the print files) where a good multi-threaded language would help. Python does well as single thread and is a great go-to language. On Jul 2, 4:05 am, faenvie wrote: > I agree, that clojure will not gain java-like popularity in > a forseeable future. > > IMO clojure is much more a Language for SystemProgrammers > (high demands, thinking in concurrency) than a Language for > ApplicationProgrammers (midsize demands, thinking singlethread) > it does not have to target general purpose use. But Very well could > clojure become a mainstream-language for SystemProgrammers. > > other promising perspectives for clojure: > > - as a base for true innovation (core.logic) > > - for programming android (compile to dex) -- 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: Filling let local variable from sequence
Phew! Thank you. That did it. I did need to add the nil to each nth statement, but this helps. (defn process-file "Process csv file and prints a column in every row" [file-name] (let [data (slurp file-name) rows (parse-csv data) read-map (zipmap (map #(nth % 11 nil) rows) (map #(nth % 1 nil) rows))] (println read-map))) On Jun 30, 4:48 pm, Ken Wesson wrote: > On Thu, Jun 30, 2011 at 4:30 PM, octopusgrabbus > > > > > > > > > > wrote: > > Thanks for answering. > > > I want to create a map of this output: > > > PremiseID Reading > > 61016 101100 > > 610159000 411200 > > 610158000 133100 > > 610157000 239400 > > nil nil > > > produced by this function > > > (defn process-file > > "Process csv file and prints a column in every row" > > [file-name] > > (let [data (slurp file-name) > > rows (parse-csv data)] > > (doseq [this-row rows] (println (nth this-row 11 nil) (nth > > this-row 1 nil) > > > from this data: > > > "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" > > 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", > > 80581200,43,0,75,"2011-06-06 06:00:01","61016" > > 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", > > 80598726,43,0,75,"2011-06-06 06:00:01","610159000" > > 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", > > 80581189,43,0,75,"2011-06-06 06:00:01","610158000" > > 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE > > C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" > > Then you want (zipmap (map #(nth % 11) rows) (map #(nth % 1) rows)). > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Filling let local variable from sequence
I need to clarify my previous answer. In each row of vectors I want to extract two columns and make a map of those. For example, for each premiseid, there is a reading. So for this line of data 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", 80581200,43,0,75,"2011-06-06 06:00:01","61016" I want to map the premise id "61016" to the reading 101100. On Jun 30, 4:24 pm, Ken Wesson wrote: > On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus > > > > > > > > > > wrote: > > The dorun in this function > > > (defn process-file > > "Process csv file and prints first item in every row" > > [file-name] > > (let [data (slurp file-name) > > rows (parse-csv data)] > > (dorun (map #(println (first %)) rows > > > causes each row of vectors in rows to be processed. > > > (doseq [a-row rows] (println a-row) ) > > > would print each row in the data, which looks like this (the real > > data, not the test data I've been using today.) > > > "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" > > 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", > > 80581200,43,0,75,"2011-06-06 06:00:01","61016" > > 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", > > 80598726,43,0,75,"2011-06-06 06:00:01","610159000" > > 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", > > 80581189,43,0,75,"2011-06-06 06:00:01","610158000" > > 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE > > C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" > > > It would be nice if the let statement would allow populating a local > > variable from iterating all the rows of vectors. I just can't figure > > out how to do it. > > So you just want a variable bound to a flat list of the things in the > vectors, or of the vectors themselves? > > (let [x seq-of-vectors]) > > will accomplish the latter, and > > (let [x (apply concat seq-of-vectors)]) > > the former. > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Filling let local variable from sequence
Thanks, Ken. Our answers crossed. I'll go try your suggestions. On Jun 30, 4:24 pm, Ken Wesson wrote: > On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus > > > > > > > > > > wrote: > > The dorun in this function > > > (defn process-file > > "Process csv file and prints first item in every row" > > [file-name] > > (let [data (slurp file-name) > > rows (parse-csv data)] > > (dorun (map #(println (first %)) rows > > > causes each row of vectors in rows to be processed. > > > (doseq [a-row rows] (println a-row) ) > > > would print each row in the data, which looks like this (the real > > data, not the test data I've been using today.) > > > "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" > > 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", > > 80581200,43,0,75,"2011-06-06 06:00:01","61016" > > 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", > > 80598726,43,0,75,"2011-06-06 06:00:01","610159000" > > 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", > > 80581189,43,0,75,"2011-06-06 06:00:01","610158000" > > 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE > > C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" > > > It would be nice if the let statement would allow populating a local > > variable from iterating all the rows of vectors. I just can't figure > > out how to do it. > > So you just want a variable bound to a flat list of the things in the > vectors, or of the vectors themselves? > > (let [x seq-of-vectors]) > > will accomplish the latter, and > > (let [x (apply concat seq-of-vectors)]) > > the former. > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Filling let local variable from sequence
Thanks for answering. I want to create a map of this output: PremiseID Reading 61016 101100 610159000 411200 610158000 133100 610157000 239400 nil nil produced by this function (defn process-file "Process csv file and prints a column in every row" [file-name] (let [data (slurp file-name) rows (parse-csv data)] (doseq [this-row rows] (println (nth this-row 11 nil) (nth this-row 1 nil) from this data: "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", 80581200,43,0,75,"2011-06-06 06:00:01","61016" 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", 80598726,43,0,75,"2011-06-06 06:00:01","610159000" 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", 80581189,43,0,75,"2011-06-06 06:00:01","610158000" 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" tnx cmn On Jun 30, 4:24 pm, Ken Wesson wrote: > On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus > > > > > > > > > > wrote: > > The dorun in this function > > > (defn process-file > > "Process csv file and prints first item in every row" > > [file-name] > > (let [data (slurp file-name) > > rows (parse-csv data)] > > (dorun (map #(println (first %)) rows > > > causes each row of vectors in rows to be processed. > > > (doseq [a-row rows] (println a-row) ) > > > would print each row in the data, which looks like this (the real > > data, not the test data I've been using today.) > > > "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" > > 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", > > 80581200,43,0,75,"2011-06-06 06:00:01","61016" > > 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", > > 80598726,43,0,75,"2011-06-06 06:00:01","610159000" > > 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", > > 80581189,43,0,75,"2011-06-06 06:00:01","610158000" > > 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE > > C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" > > > It would be nice if the let statement would allow populating a local > > variable from iterating all the rows of vectors. I just can't figure > > out how to do it. > > So you just want a variable bound to a flat list of the things in the > vectors, or of the vectors themselves? > > (let [x seq-of-vectors]) > > will accomplish the latter, and > > (let [x (apply concat seq-of-vectors)]) > > the former. > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Filling let local variable from sequence
The dorun in this function (defn process-file "Process csv file and prints first item in every row" [file-name] (let [data (slurp file-name) rows (parse-csv data)] (dorun (map #(println (first %)) rows causes each row of vectors in rows to be processed. (doseq [a-row rows] (println a-row) ) would print each row in the data, which looks like this (the real data, not the test data I've been using today.) "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" 33891715,101100,"2011-06-05 23:00:00","61016","SMITH","E & J", 80581200,43,0,75,"2011-06-06 06:00:01","61016" 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", 80598726,43,0,75,"2011-06-06 06:00:01","610159000" 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", 80581189,43,0,75,"2011-06-06 06:00:01","610158000" 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" It would be nice if the let statement would allow populating a local variable from iterating all the rows of vectors. I just can't figure out how to do it. On Jun 30, 3:28 pm, Mark Rathwell wrote: > Not sure what you mean by 'row of vectors', and 'break up each row'. > > On Thu, Jun 30, 2011 at 3:20 PM, octopusgrabbus > wrote: > > > > > > > > > If I have rows of vectors, such as the return from clojure-csv\parse- > > csv > > > ["a" 1 "b" 2 "c" 3 "d" 4] > > ["e" 5 "f" 6 "g" 7 "h" 8] > > > How can I break up each row? > > > I've tried doseq in the let statement, but get an error. > > > On Jun 30, 2:27 pm, octopusgrabbus wrote: > > > Thanks. That did it. > > > > On Jun 30, 1:22 pm, Mark Rathwell wrote: > > > > > One way would be: > > > > > (defn map-func > > > > "test map function" > > > > [] > > > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > > > read-map (apply hash-map mtr-seq) > > > > (println read-map))) > > > > > On Thu, Jun 30, 2011 at 1:09 PM, octopusgrabbus < > > octopusgrab...@gmail.com>wrote: > > > > > > Given this function > > > > > > (defn map-func > > > > > "test map function" > > > > > [] > > > > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > > > > read-map () > > > > > (println read-map))) > > > > > > I want to load read-map with the keys and values from mtr-seq. > > > > > > Eventually, this data is going to be from the return from parse-csv > > > > > (clojure-csv), but I seem to be making more progress using simpler > > > > > examples. > > > > > > The "a", "b", and so on represent a character string premise id, and > > > > > the 1, 2, and so on represent a meter read. > > > > > > My goal is to create a map, and then pass that around in other > > > > > functions. > > > > > > Thanks. > > > > > cmn > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > > > Groups "Clojure" group. > > > > > To post to this group, send email to clojure@googlegroups.com > > > > > Note that posts from new members are moderated - please be patient > > with > > > > > your first post. > > > > > To unsubscribe from this group, send email to > > > > > clojure+unsubscr...@googlegroups.com > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/clojure?hl=en > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Filling let local variable from sequence
If I have rows of vectors, such as the return from clojure-csv\parse- csv ["a" 1 "b" 2 "c" 3 "d" 4] ["e" 5 "f" 6 "g" 7 "h" 8] How can I break up each row? I've tried doseq in the let statement, but get an error. On Jun 30, 2:27 pm, octopusgrabbus wrote: > Thanks. That did it. > > On Jun 30, 1:22 pm, Mark Rathwell wrote: > > > > > > > > > One way would be: > > > (defn map-func > > "test map function" > > [] > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > read-map (apply hash-map mtr-seq) > > (println read-map))) > > > On Thu, Jun 30, 2011 at 1:09 PM, octopusgrabbus > > wrote: > > > > Given this function > > > > (defn map-func > > > "test map function" > > > [] > > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > > read-map () > > > (println read-map))) > > > > I want to load read-map with the keys and values from mtr-seq. > > > > Eventually, this data is going to be from the return from parse-csv > > > (clojure-csv), but I seem to be making more progress using simpler > > > examples. > > > > The "a", "b", and so on represent a character string premise id, and > > > the 1, 2, and so on represent a meter read. > > > > My goal is to create a map, and then pass that around in other > > > functions. > > > > Thanks. > > > cmn > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group. > > > To post to this group, send email to clojure@googlegroups.com > > > Note that posts from new members are moderated - please be patient with > > > your first post. > > > To unsubscribe from this group, send email to > > > clojure+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en