Re: REPL vs Script + Regex Problem!
Hi, On Feb 3, 1:54 am, Michał Marczyk wrote: > Something I wanted to mention is that this could provide a use case > for an Scheme style cond macro, especially if the processing logic got > more involved -- have a look at my scond if you'd like: > > http://gist.github.com/293212 > > Basically this would allow you to write things like > > (scond [(re-matches first-regex line) :>> process-result-1] > [(re-matches second-regex line) :>> process-result-2] > [(re-matches third-regex line)] ; return the matches without > further processing, if any > [:else (give-up)]) > > Although I suppose Meikel Brandmeyer's pointer may be more clojuresque... condp was specifically designed to be a scheme-like cond with :>> support and such. 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: building clojure-contrib without downloading clojure.jar from elsewhere
On Wed, Feb 3, 2010 at 1:12 AM, Rob Wolfe wrote: > there are needed two things: > > 1. maven profile, which will be activated by "-Denv=local" > 2. dependency defined with "system" scope and "systemPath" > > I can not find anything like that in clojure-contrib pom.xml. > So I added this part to original pom.xml > (just before the "" tag): Rob, thanks for educating me on the maven. I hope this will be added back into the repo soon. -- Ramakrishnan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: The Best Way to Accomplish This...
On Feb 2, 7:53 pm, Wardrop wrote: > I feel like I'm over-staying my welcome by posting yet another topic, > so please only answer if you get some form of enjoyment out of solving > such problems as this one. > > I've given this problem a fair bit of my time, and it's been good so > far as it's forced me to learn new things and challenge my rather > immature knowledge of clojure. I want to turn to the answers section > now though, which is what I'm hoping to get on this forum. So here's > what I'm trying to do... > > I need to pass a 32mb text file of duplicate file entries. I need to > be able to get the total number of duplicates as well as the total > size the duplicates are taking up. As a bonus, it would be good to > provide an additional categorisation by file extension (.jpg = > 450.02mb, .bak = 5.65GB, etc). Here's how the file is formatted... > > 71 byte(null)each: > ./atgiss1/profiles/rebeccat/DataWorks/DataWorks LIVE/dwlui.ini > ./atgiss1/profiles/alistairh/DataWorks/DataWorks LIVE/dwlui.ini > > 14171 byte(null)each: > ./atgiss1/profiles/rebeccat/My Documents/Corel User Files/WT9_1US.UWL > ./atgiss1/profiles/guyc/My Documents/Corel User Files/WT9_1US.UWL > ./atgiss1/profiles/carls/My Documents/Corel User Files/WT9_1US.UWL > > 102 byte(null)each: > ./atgiss1/profiles/rebeccat/Application Data/AdobeUM/AcRdB7_0_7.sta > ./atgiss1/profiles/rebeccat/Application Data/AdobeUM/AcRdB7_0_8.sta > > Do note however, that when computing sizes, do not take into account > the first file, as we only want to know the total space being taken up > by the duplicates, not the original file. > > I've already implemented this in Scala, where I use global variable to > keep track of persistent data. I'm finding it hard to morph that > concept into Clojure, which makes me believe I'm going about it the > wrong way. Hopefully someone here can demonstrate one of the right > ways. To get you started, here's a bit of a proof of concept... > > (use '[clojure.contrib.duck-streams]) > > (for [line (line-seq (reader "C:\\atgisfiledupes.txt"))] > (some #(if ((first %) 1) %) > [{:size (get (re-matches #"([0-9]+) byte\(null\)each:" line) 1)} > {:file (get (re-matches #".*(\.[0-9a-zA-Z]+)" line) 1)} > (if (= line "") {:blank true} {:other true})])) > > (println "Finished!") > > If anything, it should give the regex you need to extract data from > the various lines. > > All replies are much appreciated. > > Cheers How about this: http://gist.github.com/293388 Once you call (read-dups "file.txt") and have the seq of dup structs, you can extract what you need. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Request for advice on java interop namespace hunting
Any half-way decent IDE should have a shortcut for resolving wildcard imports to be fully-qualified. On Feb 2, 7:31 pm, Timothy Pratley wrote: > Hi, > > I've found myself a few times in a situation where I'm banging some > java code into clojure, and the java source uses import foo.* blah.* > bar.* Now Clojure requires explicit class naming (which I fully > support) so I end up spending a good slice of time googling "java > SomeWierdClass someapi" to get all the import names, recompile, find > next one, google, update... its a very slow cycle. How do other people > do this? > > Regards, > Tim. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: The Best Way to Accomplish This...
Ouch, just noticed that the counts get accumulated by extension... In this case it's probably best to add the current size to a counter stored in the map entry when there's a duplicate. It's a minor tweak, though. Sincerely, Michał -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: The Best Way to Accomplish This...
How about this for a start? (reduce (fn [m line] (if (empty? line) m (if-let [size (get (re-matches #"([0-9]+) byte\(null\)each:" line) 1)] (merge m {:size size}) (if-let [file (get (re-matches #".*(\.[0-9a-zA-Z]+)" line) 1)] (let [size (:size m)] (merge-with (fn [[cnt size] _] [(inc cnt) size]) m {file [0 size]})) (throw (IllegalStateException. (str "not sure what to do with \"" line "\""))) {} (line-seq (reader "/home/windfall/hacking/sharpening-of-the-saw/test-data/test1.in"))) For your sample data, the above produces: {".sta" [1 "102"], ".UWL" [2 "14171"], ".ini" [1 "71"], :size "102"} You'll probably need to drop the :size key from the result map, convert strings to integers, multiply counts by sizes etc. -- I leave that to you. All best, Michał -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
The Best Way to Accomplish This...
I feel like I'm over-staying my welcome by posting yet another topic, so please only answer if you get some form of enjoyment out of solving such problems as this one. I've given this problem a fair bit of my time, and it's been good so far as it's forced me to learn new things and challenge my rather immature knowledge of clojure. I want to turn to the answers section now though, which is what I'm hoping to get on this forum. So here's what I'm trying to do... I need to pass a 32mb text file of duplicate file entries. I need to be able to get the total number of duplicates as well as the total size the duplicates are taking up. As a bonus, it would be good to provide an additional categorisation by file extension (.jpg = 450.02mb, .bak = 5.65GB, etc). Here's how the file is formatted... 71 byte(null)each: ./atgiss1/profiles/rebeccat/DataWorks/DataWorks LIVE/dwlui.ini ./atgiss1/profiles/alistairh/DataWorks/DataWorks LIVE/dwlui.ini 14171 byte(null)each: ./atgiss1/profiles/rebeccat/My Documents/Corel User Files/WT9_1US.UWL ./atgiss1/profiles/guyc/My Documents/Corel User Files/WT9_1US.UWL ./atgiss1/profiles/carls/My Documents/Corel User Files/WT9_1US.UWL 102 byte(null)each: ./atgiss1/profiles/rebeccat/Application Data/AdobeUM/AcRdB7_0_7.sta ./atgiss1/profiles/rebeccat/Application Data/AdobeUM/AcRdB7_0_8.sta Do note however, that when computing sizes, do not take into account the first file, as we only want to know the total space being taken up by the duplicates, not the original file. I've already implemented this in Scala, where I use global variable to keep track of persistent data. I'm finding it hard to morph that concept into Clojure, which makes me believe I'm going about it the wrong way. Hopefully someone here can demonstrate one of the right ways. To get you started, here's a bit of a proof of concept... (use '[clojure.contrib.duck-streams]) (for [line (line-seq (reader "C:\\atgisfiledupes.txt"))] (some #(if ((first %) 1) %) [{:size (get (re-matches #"([0-9]+) byte\(null\)each:" line) 1)} {:file (get (re-matches #".*(\.[0-9a-zA-Z]+)" line) 1)} (if (= line "") {:blank true} {:other true})])) (println "Finished!") If anything, it should give the regex you need to extract data from the various lines. All replies are much appreciated. Cheers -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Request for advice on java interop namespace hunting
Whenever I had to do this, I put the java code in a separate java file in IntelliJ, and let it figure out the list of imports. I then paste them into clojure. Works well since I also use IntelliJ for clojure anyway. On Tue, Feb 2, 2010 at 10:31 PM, Timothy Pratley wrote: > Hi, > > I've found myself a few times in a situation where I'm banging some > java code into clojure, and the java source uses import foo.* blah.* > bar.* Now Clojure requires explicit class naming (which I fully > support) so I end up spending a good slice of time googling "java > SomeWierdClass someapi" to get all the import names, recompile, find > next one, google, update... its a very slow cycle. How do other people > do this? > > > Regards, > Tim. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Request for advice on java interop namespace hunting
I've found myself a few times in a situation where I'm banging some java code into clojure, and the java source uses import foo.* blah.* bar.* Now Clojure requires explicit class naming (which I fully support) so I end up spending a good slice of time googling "java SomeWierdClass someapi" to get all the import names, recompile, find next one, google, update... its a very slow cycle. How do other people do this? That's pretty much how I do it, though I don't really use the compiler to prompt me -- I try to get it right the first time. I spend a lot of time looking at Javadocs, replicating work that Eclipse would do for me. jar tf somelib.jar will produce a nice list of classes... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Request for advice on java interop namespace hunting
Hi, I've found myself a few times in a situation where I'm banging some java code into clojure, and the java source uses import foo.* blah.* bar.* Now Clojure requires explicit class naming (which I fully support) so I end up spending a good slice of time googling "java SomeWierdClass someapi" to get all the import names, recompile, find next one, google, update... its a very slow cycle. How do other people do this? Regards, Tim. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
require macro/function [was clojure.contrib.[duck-streams io]]
In teaching people Clojure, non-intuitive behavior with use/require is the #1 problem for beginners, by a mile. I believe we need both ordinary function and macro versions, and I am pretty sure that a well- considered patch implementing this would be accepted. SS: is require* an acceptable name for the function version? Stu On Feb 2, 2:46 am, ataggart wrote: On a related note, it is my sincere hope that we get a version of require and use which no longer require (ha!) the use of quoted parens. Absolutely not! Having 'require' as an ordinary function (not a macro) is important for code-generating code. -SS -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
Something I wanted to mention is that this could provide a use case for an Scheme style cond macro, especially if the processing logic got more involved -- have a look at my scond if you'd like: http://gist.github.com/293212 Basically this would allow you to write things like (scond [(re-matches first-regex line) :>> process-result-1] [(re-matches second-regex line) :>> process-result-2] [(re-matches third-regex line)] ; return the matches without further processing, if any [:else (give-up)]) Although I suppose Meikel Brandmeyer's pointer may be more clojuresque... To redeem myself after proposing something so nonidiomatic, I'd like to point out that instead of wrapping the for in a dorun, you could replace the for with doseq. :-) Sincerely, Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
(some) definitely seems like the way to go. Now I've got to move onto my next problem, which is totally the number of duplicate files and the bytes they take up. I'm guessing at this point that something like (reduce) will be the way to go. Thanks for all your help. This won't be the last time you'll hear from me. On Feb 3, 9:57 am, Michał Marczyk wrote: > On 3 February 2010 00:50, ataggart wrote: > > > It occurs to me you could use 'some instead of nested if-lets: > > > (some identity > > [(first (re-matches #"([0-9]+) byte\(null\)each:" line)) > > (first (re-matches #".*(\.[0-9a-zA-Z]+)" line))]) > > A simplified version: > > (some #(first (re-matches % line)) [first-regex second-regex]) > > Sincerely, > Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
On 3 February 2010 00:50, ataggart wrote: > It occurs to me you could use 'some instead of nested if-lets: > > (some identity > [(first (re-matches #"([0-9]+) byte\(null\)each:" line)) > (first (re-matches #".*(\.[0-9a-zA-Z]+)" line))]) A simplified version: (some #(first (re-matches % line)) [first-regex second-regex]) Sincerely, Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
It occurs to me you could use 'some instead of nested if-lets: (some identity [(first (re-matches #"([0-9]+) byte\(null\)each:" line)) (first (re-matches #".*(\.[0-9a-zA-Z]+)" line))]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
On Feb 2, 3:02 pm, Wardrop wrote: > The problem is, the only output I get is "Finished!". If however, I > run this on the command line, I get a long list of nil's in amongst > the strings "Byte pattern!" and "File pattern!". I expect the nil's > not to show when this is run as a script, but why are the > aforementioned strings not being output? Just a guess, but perhaps none of your tests pass: user=> (cond false :foo) nil > Anyway, I not only want the regex to be used > in the condition expression, but also want to capture the first sub- > match (i.e. what's in the parenthesis inside the regex). What's the > best way I can do this, without having to re-run the regex twice. The :>> keyword used by condp is sort of what you want, except the test mechanism of condp isn't (there has been talk of adding :>> to cond). For now I'd say the simplest thing is nested if-lets. On a related note, if the regex-related function returns nil when there's no match then you can use that as the test, rather than bothering with (complement nil?). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: REPL vs Script + Regex Problem!
Hi, Am 02.02.2010 um 23:48 schrieb Wardrop: > (for [line (line-seq (reader "C:\\filedupes.txt"))] > (cond >((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" > line)) > (println "Byte pattern!") >((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) > (println "File pattern!") > ) > ) > > (println "Finished!") > > The problem is, the only output I get is "Finished!". If however, I > run this on the command line, I get a long list of nil's in amongst > the strings "Byte pattern!" and "File pattern!". I expect the nil's > not to show when this is run as a script, but why are the > aforementioned strings not being output? As Kevin said: for is lazy. The println's never get evaluated because the sequence is not realised. In the repl it is (the printed nils) and hence the println's are executed. > While you're at it, you may be able to help me with an additional > problem I'm trying to tackle. As you can see if the above code, I'm > trying to match on certain lines of a text file. I'm using "cond" to > do this with as a switch statement is the only way I know how to > achieve what I'm after. Anyway, I not only want the regex to be used > in the condition expression, but also want to capture the first sub- > match (i.e. what's in the parenthesis inside the regex). What's the > best way I can do this, without having to re-run the regex twice. This might get you started: http://groups.google.com/group/clojure/msg/d9ef152e19f5416b 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: REPL vs Script + Regex Problem!
Haha, I was just trying out traditional formatting with clojure and had left it that way without noticing. As for the lazy thing, I should have known that as it wasn't long ago I was ready about laziness in the book I'm reading. Wrapping (dorun) around the (for) loop has fixed it. Could someone now help me with my second problem? Cheers On Feb 3, 8:50 am, Kevin Downey wrote: > for is lazy, and your code formatting is horrible. > > > > On Tue, Feb 2, 2010 at 2:48 PM, Wardrop wrote: > > I've noticed that the output of a script, is often different to the > > output of the same commands if run on the REPL. This makes sense, but > > here's a situation which has got me a little confused. I'm trying to > > run this code as a script... > > > (use '[clojure.contrib.duck-streams]) > > > (for [line (line-seq (reader "C:\\filedupes.txt"))] > > (cond > > ((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" > > line)) > > (println "Byte pattern!") > > ((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) > > (println "File pattern!") > > ) > > ) > > > (println "Finished!") > > > The problem is, the only output I get is "Finished!". If however, I > > run this on the command line, I get a long list of nil's in amongst > > the strings "Byte pattern!" and "File pattern!". I expect the nil's > > not to show when this is run as a script, but why are the > > aforementioned strings not being output? > > > While you're at it, you may be able to help me with an additional > > problem I'm trying to tackle. As you can see if the above code, I'm > > trying to match on certain lines of a text file. I'm using "cond" to > > do this with as a switch statement is the only way I know how to > > achieve what I'm after. Anyway, I not only want the regex to be used > > in the condition expression, but also want to capture the first sub- > > match (i.e. what's in the parenthesis inside the regex). What's the > > best way I can do this, without having to re-run the regex twice. > > > 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 > > -- > And what is good, Phaedrus, > And what is not good— > Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: REPL vs Script + Regex Problem!
for is lazy, and your code formatting is horrible. On Tue, Feb 2, 2010 at 2:48 PM, Wardrop wrote: > I've noticed that the output of a script, is often different to the > output of the same commands if run on the REPL. This makes sense, but > here's a situation which has got me a little confused. I'm trying to > run this code as a script... > > (use '[clojure.contrib.duck-streams]) > > (for [line (line-seq (reader "C:\\filedupes.txt"))] > (cond > ((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" > line)) > (println "Byte pattern!") > ((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) > (println "File pattern!") > ) > ) > > (println "Finished!") > > The problem is, the only output I get is "Finished!". If however, I > run this on the command line, I get a long list of nil's in amongst > the strings "Byte pattern!" and "File pattern!". I expect the nil's > not to show when this is run as a script, but why are the > aforementioned strings not being output? > > While you're at it, you may be able to help me with an additional > problem I'm trying to tackle. As you can see if the above code, I'm > trying to match on certain lines of a text file. I'm using "cond" to > do this with as a switch statement is the only way I know how to > achieve what I'm after. Anyway, I not only want the regex to be used > in the condition expression, but also want to capture the first sub- > match (i.e. what's in the parenthesis inside the regex). What's the > best way I can do this, without having to re-run the regex twice. > > 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 -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
REPL vs Script + Regex Problem!
I've noticed that the output of a script, is often different to the output of the same commands if run on the REPL. This makes sense, but here's a situation which has got me a little confused. I'm trying to run this code as a script... (use '[clojure.contrib.duck-streams]) (for [line (line-seq (reader "C:\\filedupes.txt"))] (cond ((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" line)) (println "Byte pattern!") ((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) (println "File pattern!") ) ) (println "Finished!") The problem is, the only output I get is "Finished!". If however, I run this on the command line, I get a long list of nil's in amongst the strings "Byte pattern!" and "File pattern!". I expect the nil's not to show when this is run as a script, but why are the aforementioned strings not being output? While you're at it, you may be able to help me with an additional problem I'm trying to tackle. As you can see if the above code, I'm trying to match on certain lines of a text file. I'm using "cond" to do this with as a switch statement is the only way I know how to achieve what I'm after. Anyway, I not only want the regex to be used in the condition expression, but also want to capture the first sub- match (i.e. what's in the parenthesis inside the regex). What's the best way I can do this, without having to re-run the regex twice. 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: Transients question/feedback
> > My guess is that the resulting ephemeral garbage would have only a > > small effect on performance > > An interesting data point on ephemeral garbage that was quite > eye-opening: Somewhere in the talk below, Cliff Click says that the > problem with high-volume ephemeral garbage lies in the cache trashing > behavior of "streaming allocation" -- which itself results from the > JVM's neat pointer-bumping allocator being used to allocate lots of > highly ephemeral garbage. Yes, that's a great presentation and I'd be the last one to contradict Cliff Click on JVM performance, but I think it's somewhat out of context here. I'll only respond by quoting Rich Hickey (see http://markmail.org/message/ygt2nhjqoo6cyy77): "One of the critical design requirements was to treat ephemeral garbage as cheap, and that has worked well in practice - the JIT and optimizers seem extremely good with short term ephemeral memory use and all-final immutable classes." Of course, that's an old quote, he's talking about _persistent_ data structures there, and transients are specifically intended to be even lower overhead for the cases that it's safe. But until somebody actually tries it I'm just not convinced that the penalty isn't small enough to be justified for more understandable behavior. -moss -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Transients question/feedback
On Feb 1, 6:39 pm, Richard Newman wrote: > If you're adding a new TransientVector instance on every call to > conj!, you might as well just use conj. I think not. The reason building a huge transient vector is faster than building a huge persistent vector isn't the Vector instance created by each conj, it's the multiple arrays of 32 references each that it has to allocate and copy. My proposed change wouldn't do that, it would just make a new, tiny object to hold onto the same mutating arrays. If the vector is being built in a loop, it's possible escape analysis would allow HotSpot to eliminate the allocation altogether. Anyway, at this point it's just conjecture, which I was hoping to motivate someone else to test, but it doesn't seem to have worked, so I guess it's up to me to do the experiment ;) > Making transients slower -- even by a small amount -- strikes me as > contrary to Rich's position. > Making them safer is analogous to asking for checks to be added to > unchecked math operations. You'd certainly be right if the slowdown means that transients aren't still _much_ more efficient than persistent vectors. But it they're still much faster, but not quite as fast as "unsafe" transients, then I think the question is certainly debatable. > You should *never* be shoving transients into vars, IMO. Agreed. It was just easier to get the point across that way than with a more complex (and real) example. I'll post again when I have a patch and numbers to back up my speculation. - moss -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Rich's "Clojure in Clojure" talk at the NYC group
This email was cut-off from what I intended to send, sorry. What I meant to say, was that, unfortunately the video cuts off after 10 minutes. Are the slides for this talk available somewhere? Thanks, Aaron On Feb 2, 3:44 pm, Aaron Cohen wrote: > Hi guys, > I was watching the "Clojure in Clojure" talk that I saw linked from > the "disclojure" blog (very useful to me by the way, thank you > nameless to me person who does it > -- Aaron -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 clojure-contrib without downloading clojure.jar from elsewhere
On Feb 2, 2:42 pm, Rob Wolfe wrote: > In order to use command like this: > > mvn -Denv=local -Dclojure.jar=/path/to/clojure.jar package > > there are needed two things: > > 1. maven profile, which will be activated by "-Denv=local" > 2. dependency defined with "system" scope and "systemPath" Whoops, that was in the POM but got deleted in one of the commits. I will re-add it. -SS -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojars question
Hey Konrad, Konrad Hinsen writes: > I would like to deposit a small library on clojars.org. Is it possible > to do this without using either Maven or Leiningen? Neither of these > tools seems to be appropriate for my library. Sure, you can just write the POM by hand. The reason the POM is necessary is so clojars knows the groupId, artifacId, version and description of your lib. So just create the jar however you want (eg just use the 'jar' command-line tool). Then create a pom.xml file with a text editor. If you have no dependencies then at the bare minimum all you need is this: 4.0.0 yourlib yourlib 1.0.0 Does awesome things. Finally just upload it to clojars with scp: scp pom.xml yourlib.jar cloj...@clojars.org: > If my understanding of Leiningen and Maven is correct, neither one can > handle "any Clojure version" as a dependency. But it seems that > Clojars wants a pom.xml, which I don't know how to generate otherwise. There is a syntax for specifying version ranges in dependencies: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges It should work with Maven and since Leiningen uses Maven for dependency resolution in theory it should work with Leiningen too (I haven't tried it). However if your lib depends on nothing but clojure.core, then you may as well leave off dependency section entirely, as anyone consuming it is going to specify which version of Clojure they want. Cheers, Alex -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure Libraries page out of date
http://clojure.org/libraries is out of date Gorilla was merged with VimClojure, and I think I saw other problems... Also, the organization of this page is messy and could use some taxonomy help. Reminds me too much of the Eclipse plug-ins page: out of control. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Rich's "Clojure in Clojure" talk at the NYC group
Hi guys, I was watching the "Clojure in Clojure" talk that I saw linked from the "disclojure" blog (very useful to me by the way, thank you nameless to me person who does it -- Aaron -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Heap implementation in Clojure
What is the time and space complexity for your implementation? Equals the normal non-functional implementation? On Tue, Feb 2, 2010 at 7:31 AM, e wrote: > i was messing around a while back with this: > http://code.google.com/p/jc-pheap/ > > the algorithms work, but it's probably in a between-state. I wasn't sure > what the interface should look like exactly, and I was recently adding > support for duplicate keys (but I wasn't sure if I should have two > structures or one ... the latter being more of the multimap I'm describing). > > Oh, and I was starting to work on decreaseKey(), too ... but the runtime is > still, likely amortized for that one. I actually had an idea that I'm not > sure has ever been done before to make that operation even more baked. Fun > stuff. > > The project does not depend on clojure, but shows clojure code as an > example. If I recall, it all works. H, maybe I'll get back into > working on it and variations, tho. > > On Tue, Dec 15, 2009 at 5:16 AM, ataggart wrote: > >> >> >> On Dec 15, 1:49 am, ataggart wrote: >> > On Dec 14, 5:48 am, Mark Tomko wrote: >> > >> > > I wrote this implementation of a heap (or priority queue) in pure >> > > Clojure: >> > >> > >http://pastebin.com/m2ab1ad5a >> > >> > > It's probably not of any quality sufficient to be make it to the >> > > contrib package, but it seems to work. Any thoughts on how it might >> > > be improved? >> > >> > > Thanks, >> > > Mark >> > >> > Ideally such a collection would be usable with existing functions, >> > e.g. pop, peek. To accomplish that you really need to implement >> > against the expected java interfaces. >> > >> > I've been playing with the deftype/defprotocol stuff in the "new" >> > branch, so I figured I'd try to apply that to this problem. This is >> > what I came up with: >> > >> > http://gist.github.com/256815 >> >> To be clear, my implementation just uses a sorted list, not a true >> heap tree. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from 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: building clojure-contrib without downloading clojure.jar from elsewhere
Ramakrishnan Muthukrishnan writes: > Hi, > > I am trying to package clojure-contrib for Debian and one of the > debian java packaging practices is that the build should not download > any external dependencies. All the dependencies should be debian > packages themselves. > > I tried building clojure-contrib with mvn -Dclojure.jar= locally built clojure.jar> as detailed in the README.txt, but maven > seem to ignore this and download the jar from the build server. To > replicate this, please try removing > ~/.m2/repository/org/clojure/clojure directory. I also tried passing > the -o flag to maven, but it fails to take the local clojure.jar file. > I am very new to java build systems like maven, so it is very likely > that I am missing something. I will be happy to try out any > suggestions I can get from here. In order to use command like this: mvn -Denv=local -Dclojure.jar=/path/to/clojure.jar package there are needed two things: 1. maven profile, which will be activated by "-Denv=local" 2. dependency defined with "system" scope and "systemPath" I can not find anything like that in clojure-contrib pom.xml. So I added this part to original pom.xml (just before the "" tag): env-local env local org.clojure clojure ${clojure.version} system ${clojure.jar} and now this command: mvn -Denv=local -Dclojure.jar=/path/to/clojure.jar package started to work. This profile can be activate also like this: mvn -P env-local -Dclojure.jar=/path/to/clojure.jar package Br, Rob -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Clojars question
Hi, Am 02.02.2010 um 19:11 schrieb Konrad Hinsen: > I would like to deposit a small library on clojars.org. Is it possible to do > this without using either Maven or Leiningen? Neither of these tools seems to > be appropriate for my library. > > My library consists of just a few very small source code files. It doesn't > need to be AOT compiled, and by not AOT-compiling it is compatible with all > Clojure versions (official releases and snapshots). A single source-file jar > should thus be fine for everyone. > > If my understanding of Leiningen and Maven is correct, neither one can handle > "any Clojure version" as a dependency. But it seems that Clojars wants a > pom.xml, which I don't know how to generate otherwise. clojuresque is independent of the Clojure version used in the project and allows easy deployment of non-AOT'd jars to Clojars. It handles POM and jar generation and gives reflection warnings (if desired) even if not AOT'ing. But gradle might be a too heavy dependence. YMMV. Sincerely Meikel PS: On Windows deployment to Clojars does not work due to scp trouble. Only Unix/Mac OS X supported at the moment for deployment. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
On 2 February 2010 16:05, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: >> On a related note, it is my sincere hope that we get a version of >> require and use which no longer require (ha!) the use of quoted >> parens. > > Absolutely not! Having 'require' as an ordinary function (not a > macro) is important for code-generating code. That hardly precludes having a macro *version* of require alongside the ordinary function. Say, rename require to require*, then do (defmacro require [require-spec] `(require* '~require-spec)) Having said that, I for one am quite happy with the present day ns / require / use / etc. scheme and don't care either way about macroification of require / use, as long as the current ordinary functions remain accessible under some reasonable names. Sincerely, Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 offline documentation (clojure.org, Core API, Contrib API) in CHM / Microsoft HTML Help format
hi all, i am new to clojure (and new to this list). i find clojure.org and the api documentation at github a great resource for learning. however, i am missing a comprehensive, compact and searchable offline version (and i did look around). so i did what i always do in this case [1]: make * a comprehensive, compact and searchable offline version in CHM / Microsoft HTML Help format [2]. it includes the user doc from clojure.org and the api doc for both core and contrib. the chm file is less than 1M in size, has a (manually adjusted) toc, and is fully searchable. you can get it from http://chm.kollm.org/clojure-doc.chm i find it quite helpful - maybe others do so, too. axel p.s. i noticed some broken links in the clojure.org documentation. apparently, "Reference > API", which now points to github (core api doc), used to point to http://clojure.org/API. that latter link is still used by "java_interop", "macros", "reader", "Reference", "sequences", and "state". maybe this could be fixed. * as it doesn't seem to be trivial to getting the (wiki) source of the website [3], let alone converting it and the source of core and contrib api doc to html (incl. working links), i went the easier route of just downloading everything. i used HTTrack [4], which, after some fiddling with the settings (robots.txt, outgoing domains) worked almost perfectly. the downloaded files than just had to be adjusted a little and put into Microsoft's HTML Help Workshop [5]. [1] http://chm.kollm.org/ [2] http://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help [3] http://groups.google.com/group/clojure/browse_thread/thread/f68128213c9c6b77 [4] http://httrack.com/ [5] http://msdn.microsoft.com/en-us/library/ms670169%28VS.85%29.aspx -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
And of course, that *does* work, thus my complaint was moot, and the symbol non-resolution was probably what Stuart was so aghast about (even though it wasn't my point). As Michael said: I wish I'd realised that just before posting rather than just after :) On Feb 2, 10:50 am, ataggart wrote: > And of course that should be (require '[clojure.contrib string io]) or > (require ['clojure.contrib 'string 'io]) so the symbols don't try to > get resolved. > > On Feb 2, 10:41 am, ataggart wrote: > > > > > On Feb 2, 7:05 am, Stuart Sierra wrote: > > > > On Feb 2, 2:46 am, ataggart wrote: > > > > > On a related note, it is my sincere hope that we get a version of > > > > require and use which no longer require (ha!) the use of quoted > > > > parens. > > > > Absolutely not! Having 'require' as an ordinary function (not a > > > macro) is important for code-generating code. > > > > -SS > > > I don't understand the exclamatory critique. What would be the > > problem with the following actually working (as it similarly does in > > ns)? > > > (require [clojure.contrib string io]) > > > So far as I am aware, it is most idiomatic in clojure to write literal > > collections with vector brackets instead of quoted list parens. I'm > > of the mind that one should prefer vector notation unless one requires > > a list type, or is calling a function, or is emitting code from a > > macro. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
And of course that should be (require '[clojure.contrib string io]) or (require ['clojure.contrib 'string 'io]) so the symbols don't try to get resolved. On Feb 2, 10:41 am, ataggart wrote: > On Feb 2, 7:05 am, Stuart Sierra wrote: > > > On Feb 2, 2:46 am, ataggart wrote: > > > > On a related note, it is my sincere hope that we get a version of > > > require and use which no longer require (ha!) the use of quoted > > > parens. > > > Absolutely not! Having 'require' as an ordinary function (not a > > macro) is important for code-generating code. > > > -SS > > I don't understand the exclamatory critique. What would be the > problem with the following actually working (as it similarly does in > ns)? > > (require [clojure.contrib string io]) > > So far as I am aware, it is most idiomatic in clojure to write literal > collections with vector brackets instead of quoted list parens. I'm > of the mind that one should prefer vector notation unless one requires > a list type, or is calling a function, or is emitting code from a > macro. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
On Feb 2, 7:05 am, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: > > > On a related note, it is my sincere hope that we get a version of > > require and use which no longer require (ha!) the use of quoted > > parens. > > Absolutely not! Having 'require' as an ordinary function (not a > macro) is important for code-generating code. > > -SS I don't understand the exclamatory critique. What would be the problem with the following actually working (as it similarly does in ns)? (require [clojure.contrib string io]) So far as I am aware, it is most idiomatic in clojure to write literal collections with vector brackets instead of quoted list parens. I'm of the mind that one should prefer vector notation unless one requires a list type, or is calling a function, or is emitting code from a macro. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojars question
I would like to deposit a small library on clojars.org. Is it possible to do this without using either Maven or Leiningen? Neither of these tools seems to be appropriate for my library. My library consists of just a few very small source code files. It doesn't need to be AOT compiled, and by not AOT-compiling it is compatible with all Clojure versions (official releases and snapshots). A single source-file jar should thus be fine for everyone. If my understanding of Leiningen and Maven is correct, neither one can handle "any Clojure version" as a dependency. But it seems that Clojars wants a pom.xml, which I don't know how to generate otherwise. Konrad. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Alternate Javadocs?
On Tue, Feb 2, 2010 at 11:42 AM, Sean Devlin wrote: > As most of you know, Oracle is rapidly rebranding the sun website. > It's a matter of time before they get to the Javadocs. Given the > following: > > 1. Oracle doesn't play nice (putting it lightly) > 2. Oracle documentation is the WORST on the planet (again, putting it > lightly) > > Does someone know of an alternate place to find Javadocs? I just pulled down the latest Javadocs (JDK6) 2 days ago (post-Oracle rebranding) and they're identical to what they were before. Nothing has yet changed in that part of the distribution. I would imagine, if the rest of the changes seem to hold, that they'll simply stuff a new logo on them for the foreseeable future. On the 2nd, I'd agree, but I'd also say that Java documentation is one of the reasons it does have traction, so destroying that would be a bad idea. Not that Oracle doesn't have those. Chris -- | Chris Petrilli | petri...@amber.org -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Alternate Javadocs?
On Feb 2, 11:42 am, Sean Devlin wrote: > Does someone know of an alternate place to find Javadocs? You can (or could) download all the JDK docs as a ZIP. And lots of places, like university CS departments, mirror the JDK docs. There are several meta-javadoc search engines, but I find them annoyingly slow. -SS -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Alternate Javadocs?
Hey everyone, As most of you know, Oracle is rapidly rebranding the sun website. It's a matter of time before they get to the Javadocs. Given the following: 1. Oracle doesn't play nice (putting it lightly) 2. Oracle documentation is the WORST on the planet (again, putting it lightly) Does someone know of an alternate place to find Javadocs? Sean -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
On 2 February 2010 17:36, Michael Wood wrote: > On 2 February 2010 17:05, Stuart Sierra wrote: >> On Feb 2, 2:46 am, ataggart wrote: >>> On a related note, it is my sincere hope that we get a version of >>> require and use which no longer require (ha!) the use of quoted >>> parens. >> >> Absolutely not! Having 'require' as an ordinary function (not a >> macro) is important for code-generating code. > > That's not the only way to get rid of the quote, though. > > Have a look at ataggart's recent post about :use, :require, etc.: > http://groups.google.com/group/clojure/browse_thread/thread/6fb6a2fc0d9b3957/1f09903346c3fd4a?q=#1f09903346c3fd4a > > Compare: > > user=> (ns foo.bar > (:require [clojure.contrib [duck-streams :only [reader writer]]])) > nil > foo.bar=> > > or: > > (ns foo.bar > [:require [clojure.contrib [duck-streams :only [reader writer) > > with: > > user=> (require [clojure.contrib [duck-streams :only [reader writer]]]) > java.lang.ClassNotFoundException: clojure.contrib (NO_SOURCE_FILE:1) Damn. Never mind. I just realised that you still need the quote because clojure.contrib, duck-stream, etc. are not valid otherwise. I wish I'd realised that just before posting rather than just after :) -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
On 2 February 2010 17:05, Stuart Sierra wrote: > On Feb 2, 2:46 am, ataggart wrote: >> On a related note, it is my sincere hope that we get a version of >> require and use which no longer require (ha!) the use of quoted >> parens. > > Absolutely not! Having 'require' as an ordinary function (not a > macro) is important for code-generating code. That's not the only way to get rid of the quote, though. Have a look at ataggart's recent post about :use, :require, etc.: http://groups.google.com/group/clojure/browse_thread/thread/6fb6a2fc0d9b3957/1f09903346c3fd4a?q=#1f09903346c3fd4a Compare: user=> (ns foo.bar (:require [clojure.contrib [duck-streams :only [reader writer]]])) nil foo.bar=> or: (ns foo.bar [:require [clojure.contrib [duck-streams :only [reader writer) with: user=> (require [clojure.contrib [duck-streams :only [reader writer]]]) java.lang.ClassNotFoundException: clojure.contrib (NO_SOURCE_FILE:1) -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Trouble implementing Dijkstra algorithm in Clojure
folks may be interested in this thing I was working on a while back for Dijkstra and Branch and Bound problems: http://code.google.com/p/jc-pheap/. ... I know this was a while ago :) On Tue, Dec 8, 2009 at 11:26 PM, David Brown wrote: > On Tue, Dec 08, 2009 at 03:22:47PM -0800, ataggart wrote: > > >I would be very surprised if getting the first element from a sorted- > >set wasn't ~O(1). > > As has been mentioned, it probably isn't if the set is a tree. > > But, also, usually, in addition to getting the first element, we also > are going to want a set without the first element to represent the > rest of the data. > > Both a sorted-set and a priority-queue are probably O(log n) for the > first/rest operation, but the constant factor is likely to be quite > different. > > David > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Heap implementation in Clojure
i was messing around a while back with this: http://code.google.com/p/jc-pheap/ the algorithms work, but it's probably in a between-state. I wasn't sure what the interface should look like exactly, and I was recently adding support for duplicate keys (but I wasn't sure if I should have two structures or one ... the latter being more of the multimap I'm describing). Oh, and I was starting to work on decreaseKey(), too ... but the runtime is still, likely amortized for that one. I actually had an idea that I'm not sure has ever been done before to make that operation even more baked. Fun stuff. The project does not depend on clojure, but shows clojure code as an example. If I recall, it all works. H, maybe I'll get back into working on it and variations, tho. On Tue, Dec 15, 2009 at 5:16 AM, ataggart wrote: > > > On Dec 15, 1:49 am, ataggart wrote: > > On Dec 14, 5:48 am, Mark Tomko wrote: > > > > > I wrote this implementation of a heap (or priority queue) in pure > > > Clojure: > > > > >http://pastebin.com/m2ab1ad5a > > > > > It's probably not of any quality sufficient to be make it to the > > > contrib package, but it seems to work. Any thoughts on how it might > > > be improved? > > > > > Thanks, > > > Mark > > > > Ideally such a collection would be usable with existing functions, > > e.g. pop, peek. To accomplish that you really need to implement > > against the expected java interfaces. > > > > I've been playing with the deftype/defprotocol stuff in the "new" > > branch, so I figured I'd try to apply that to this problem. This is > > what I came up with: > > > > http://gist.github.com/256815 > > To be clear, my implementation just uses a sorted list, not a true > heap tree. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from 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.[duck-streams io]
On Feb 1, 9:23 pm, OGINO Masanori wrote: > Can I write a code on both 1.1 and master using duck-streams/io? For now, yes, as ataggart showed. But I expect names in contrib will be in flux for the next few weeks, so you should probably pick a release and stick with it. -SS -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: building clojure-contrib without downloading clojure.jar from elsewhere
Try adding the "-o" (for offline) option to the Maven command line. -SS On Feb 2, 6:20 am, Ramakrishnan Muthukrishnan wrote: > Hi, > > I am trying to package clojure-contrib for Debian and one of the > debian java packaging practices is that the build should not download > any external dependencies. All the dependencies should be debian > packages themselves. > > I tried building clojure-contrib with mvn -Dclojure.jar= locally built clojure.jar> as detailed in the README.txt, but maven > seem to ignore this and download the jar from the build server. To > replicate this, please try removing > ~/.m2/repository/org/clojure/clojure directory. I also tried passing > the -o flag to maven, but it fails to take the local clojure.jar file. > I am very new to java build systems like maven, so it is very likely > that I am missing something. I will be happy to try out any > suggestions I can get from here. > > thanks > -- > Ramakrishnan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
On Feb 2, 2:46 am, ataggart wrote: > On a related note, it is my sincere hope that we get a version of > require and use which no longer require (ha!) the use of quoted > parens. Absolutely not! Having 'require' as an ordinary function (not a macro) is important for code-generating code. -SS -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: idiomatic question about reader macro
2 ataggart Ok. I don't explain coorect why I want to have build-in ability to create reader macro. In my study and job I very often use different spesific data structures. It's very useful to have reader macro to work with them, because it makes my code easilier to perception: work with data structures differs from other code. 2 Timothy Pratley Yes I've read this artivle before, but I want to create reader macro with build-in language tools. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: update-in and get-in why no default?
Hi, On Feb 2, 2:31 pm, Timothy Pratley wrote: > > Hmm.. I thought of get-in as a recursive application of get. get-in > > now diverges from get. Maybe this version should be called "unwrap" > > instead? > > Zero applications of get to a map might be thought of as the map itself. > Are you thinking of a particular scenario where throwing an exception > would be better? Ok. One could see this like that: (get-in m [:a :b]) => (get (get m :a) :b) (get-in m [:a])=> (get m :a) (get-in m []) => m In so far I understand the picture of what happens. But does it make sense? get-in does a lookup of a key sequence in a nested structure of associative things. I think nil/[] are simply not in the domain of get- in. However it can be extended to nil/[] as the identity. So in the end it will probably boil down to some "suitable definition" argument of the domain of get-in. And I see some applications, where just returning the original thing might be handy. I'm persuaded. :) 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: update-in and get-in why no default?
On 2 February 2010 17:41, Meikel Brandmeyer wrote: > I would get rid of the if-let. Ah yes! Ok patch updated to: + ([m ks not-found] + (if (seq ks) + (get (reduce get m (butlast ks)) (last ks) not-found) + m))) Note that (seq ks) will throw an illegal argument exception if ks is 5 for instance, if ks is nil or empty the original map is preserved. > Hmm.. I thought of get-in as a recursive application of get. get-in > now diverges from get. Maybe this version should be called "unwrap" > instead? Zero applications of get to a map might be thought of as the map itself. Are you thinking of a particular scenario where throwing an exception would be better? Regards, Tim. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: update-in and get-in why no default?
Hi, On Feb 2, 1:48 pm, Timothy Pratley wrote: > > If you view 'get-in' as an unwrapping operation, unwrapping by zero steps > > should return the existing collection, no? > > Thanks for that description I completely agree. Hmm.. I thought of get-in as a recursive application of get. get-in now diverges from get. Maybe this version should be called "unwrap" instead? 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: update-in and get-in why no default?
On 2 February 2010 17:55, Richard Newman wrote: > If you view 'get-in' as an unwrapping operation, unwrapping by zero steps > should return the existing collection, no? Thanks for that description I completely agree. > Can you explain why you think the result should be nil? I was not thinking very clearly :) Loosely 'oh there is nothing to look up'. Thanks for setting me straight. > As above: I equate nil with the empty sequence. Yup. Ok patch updated - salient part is: + ([m ks not-found] + (if (seq ks) + (if-let [l (reduce get m (butlast ks))] + (get l (last ks) not-found) + not-found) + m))) Which preserves all the desired behavior so far :) http://www.assembla.com/spaces/clojure/tickets/256-get-in-optional-default-value Regards, Tim. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Line directive in Clojure
On 2 February 2010 15:39, Praki wrote: > Does Clojure have a notion of #line directive a la C/C++? This works for me: (println "file:" *file* " line:" @(clojure.lang.Compiler/LINE)) > If there is any built-in support in Clojure for ignoring blocks > delimited by special tags, as in GHC, that would be lovely! #_(ignored stuff here but careful it still needs to be parse-able ) (comment ignored stuff here) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Initiate Clojure Application
I was looking at this aspect of Clojure at the weekend and tried to blog a couple of simple examples here (http://clivetong.spaces.live.com/blog/cns!3F21DF299C355E7F!330.entry) -Original Message- From: clojure@googlegroups.com [mailto:cloj...@googlegroups.com] On Behalf Of Wardrop Sent: 01 February 2010 22:55 To: Clojure Subject: Re: How to Initiate Clojure Application Ok, this seems to work... (ns localhost.test) (clojure.main/main (println "Hello!")) I then assume I'd use the special form "do" to perform multiple unrelated tasks, such as... (clojure.main/main (do (println "Hello!") (println "Cheeso!"))) At least I can now build and run a script. On Feb 1, 6:40 pm, ataggart wrote: > You can generate a Java class with a main method (as you have done), > or you can use clojure.main: > > http://clojure.org/repl_and_main > > On Jan 31, 2:32 pm, Wardrop wrote: > > > I'm having trouble finding any resources on the net for telling me how > > to initiate a Clojure application. I'm currently using Netbeans with a > > Clojure plugin, and from what I gather from one of the examples, I > > need to define a main function as the launching point for my app, but > > there seems to be a little more to it. > > > The only example code I've found which works is this... > > > (ns localhost.test > > (:gen-class)) > > > (defn -main > > ([greetee] > > (println (str "Hello " greetee "!"))) > > ([] (-main "world"))) > > > Could someone step me through the idea behind the -main function > > (which I've also seen written as just "main" without the hyphen). I'm > > new to the JVM so I'm basically learning both Clojure and the workings > > of the JVM at the same time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 unicode on Windows
The only two lines needed (at least for me) are: (setq current-language-environment "UTF-8") (setq slime-net-coding-system 'utf-8-unix) On Jan 20, 1:13 am, Lukas Lehner wrote: > Hi > > using directly (not jline or others) > although pure REPL would be still fine, I have found how to make it work > in emacs WIN32 > not sure if all of this is needed though > > .emacs > > (setq locale-coding-system 'utf-8) > (set-terminal-coding-system 'utf-8) > (set-keyboard-coding-system 'utf-8) > (set-selection-coding-system 'utf-8) > (prefer-coding-system 'utf-8) > (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) > (set-clipboard-coding-system 'utf-16le-dos) > (set-language-environment "UTF-8") > (setqslime-net-coding-system 'utf-8-unix) > > then inslimerepl > > user> éő > ; Evaluation aborted. > user> (def éő 0) > #'user/éő > user> éő > 0 > user> > > looks ok > > Lukas > > On 1/15/2010 11:21 PM, Kevin Downey wrote: > > > > > are you using the repl directly? or wrapped in jline or rlwrap? > > > On Wed, Jan 13, 2010 at 3:02 PM, Lukas Lehner > > wrote: > > >> Ok, tried to put this at the top of the file, but same bad result on Win > >> (System/setProperty "file.encoding" "UTF8") > > >> and actually here > >>http://stackoverflow.com/questions/361975/setting-the-default-java-ch... > >> it looks like JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8has the same effect, > >> and should be used (and I am using it) > > >> Is everybody here running macs and linuxes? :( > > >> And, more important now is actually REPL > >> user=> (System/setProperty "file.encoding" "UTF8") > >> "UTF8" > >> user=> "éőó" > >> "∩┐╜o∩┐╜" > >> user=> > > >> L > > >> On 1/13/2010 11:34 PM, Kevin Downey wrote: > > >>> java uses local settings, on windows the default encoding is some > >>> godawful thing (same on Mac, still godawful, but different) set > >>> file.encoding to pick something sane > > >>> On Wed, Jan 13, 2010 at 1:52 PM, Lukas Lehner > >>> wrote: > > Hi all > > The clojure unicode reading, evaluating and printing was discussed > already > with various results. Let me add one more, and kindly ask for advice if > anyone has. > > OS: Windows 7 > clojure 1.1 > C:\>java -version > Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 > java version "1.6.0_17" > Java(TM) SE Runtime Environment (build 1.6.0_17-b04) > Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing) > > chcp: 437 > > java clojure.main > user=> éáú > java.lang.Exception: Unable to resolve symbol: ∩┐╜∩┐╜∩┐╜ in this context > (NO_SOURCE_FILE:0) > > You see the problem. > > chcp: 65001 > > java clojure.main > user=> éáú > > C:\> > > In this case REPL is killed without any message > > File unicode-test.clj in unicode: > (println (seq (.split "őúáé öüü? sdf" "\\W+"))) > > c:\>java clojure.main unicode-test.clj > Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 > Exception in thread "main" java.lang.Exception: Unable to resolve symbol: > > in this context (unicode-test.clj:0)0) > > rest of the error athttp://clojure.pastebin.com/m2235d7fb > > OS: FreeBSD 7.2 > clojure 1.1 > java -version > java version "1.6.0_07" > Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02) > Diablo Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode) > > locale > LANG=en_US.UTF-8 > LC_CTYPE="en_US.UTF-8" > LC_COLLATE="en_US.UTF-8" > LC_TIME="en_US.UTF-8" > LC_NUMERIC="en_US.UTF-8" > LC_MONETARY="en_US.UTF-8" > LC_MESSAGES="en_US.UTF-8" > LC_ALL=en_US.UTF-8 > > java clojure.main > user=> éőó > java.lang.Exception: Unable to resolve symbol: ó éőó in this context > (NO_SOURCE_FILE:0) > user=> "éőó" > "éőó" > user=> (println "éőó") > éőó > nil > user=> (def éőó 0) > java.lang.Exception: Unable to resolve symbol: 0 in this context > (NO_SOURCE_FILE:6) > user=> > > better but still not bulletproof > > testing also the same script like on windows > java clojure.main unicode-test.clj > ( sfd) > > No errors :) but of course it did not split the way I wanted... > > Anyone having better results with unicode and encoding? Preferably on > windows. > > Thank you in advance > Lukas > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your > first post. > To unsubscribe from 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
Line directive in Clojure
Greetings, Does Clojure have a notion of #line directive a la C/C++? The reason for my asking is, I am generating Clojure code which is embedded in TeX and I would like to see Clojure source code references mapped to that original file. If there is any built-in support in Clojure for ignoring blocks delimited by special tags, as in GHC, that would be lovely! Thanks, Praki -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: idiomatic question about reader macro
On Feb 2, 3:23 am, ataggart wrote: > On Feb 2, 12:19 am, "A.Rost" wrote: > > > I would like to have them available, simply because I > > like concise, purpose-built languages. > > That seems to presuppose you cannot have concise, purpose-built > languages with functions and macros. That may be the case, but I'd > like to see some rationale behind it. So far the only reason I can > think of to have a reader macro is to affect the *reader*. That should read: with *only* functions and macros. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.[duck-streams io]
Thank you. I try to use use function and it works, too. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: idiomatic question about reader macro
On Feb 2, 12:19 am, "A.Rost" wrote: > I would like to have them available, simply because I > like concise, purpose-built languages. That seems to presuppose you cannot have concise, purpose-built languages with functions and macros. That may be the case, but I'd like to see some rationale behind it. So far the only reason I can think of to have a reader macro is to affect the *reader*. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 clojure-contrib without downloading clojure.jar from elsewhere
Hi, I am trying to package clojure-contrib for Debian and one of the debian java packaging practices is that the build should not download any external dependencies. All the dependencies should be debian packages themselves. I tried building clojure-contrib with mvn -Dclojure.jar= as detailed in the README.txt, but maven seem to ignore this and download the jar from the build server. To replicate this, please try removing ~/.m2/repository/org/clojure/clojure directory. I also tried passing the -o flag to maven, but it fails to take the local clojure.jar file. I am very new to java build systems like maven, so it is very likely that I am missing something. I will be happy to try out any suggestions I can get from here. thanks -- Ramakrishnan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: file-seq and recursive directories
On 2 February 2010 10:27, Michael Wood wrote: > Of course the above is Unix-centric. On Windows you might not have > inode numbers (VFAT. Not sure if ntfs has an inode number > equivalent.) Also, I think I've heard that in Windows you can create > hard links to directories, so I don't know how they avoid loops. AFAIK Mac OS X's HFS+ allows hard links to directories since when Apple found them expedient in Time Machine's implementation. As for Windows, I'm pretty sure I had a Windows box a long time ago with a "junction" (hard link to directory) linking a name on C: with an actual directory structure stored somewhere on D:... Cool, huh? ;-) Sincerely, Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: idiomatic question about reader macro
http://briancarper.net/blog/clojure-reader-macros might interest you. On 2 February 2010 19:19, A.Rost wrote: > I would like to have them available, simply because I -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.test-contrib.test-jmx build error
On 1 February 2010 15:39, Stuart Halloway wrote: > The official JMX API is a programmer-usability disaster (IMO), and I wrote > the contrib jmx wrapper by trial-and-error to get minimal functionality > working. A few thoughts: > > * I will take a look at this (but won't be able to get to it today). Feel > free to make assembla guilt that points to me. > * My interest in having JMX support work is > my need to continue to own it. > I will have no hurt feelings if somebody jumps in and owns this before I get > to it. > > Stu Thanks for the answer! I've done some simple forensics and found a single MBean to cause the problem for me. The failing test is called various-beans-are-readable. The only MBean which is not is one whose string representation is as follows: # It only has one attribute called DiagnosticOptions. An attempt to read its value with jmx/read-supported leads to the following: java.lang.NullPointerException [Thrown class javax.management.RuntimeMBeanException] I put the backtrace here: http://pastie.org/805683 Also, here's the MBeanInfo (obtained through (.getMBeanInfo jmx/*connection* the-monster-mbean)): http://pastie.org/805689 And finally, java -version: java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1) OpenJDK Server VM (build 14.0-b16, mixed mode) Hope this helps. If there's something else I could check, I'll gladly do so. Sincerely, Michal -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: more lazy "fun"
Hi On 2 February 2010 01:20, rzeze...@gmail.com wrote: [...] > user> (doc and) > - > clojure.core/and > ([] [x] [x & next]) > Macro > Evaluates exprs one at a time, from left to right. If a form > returns logical false (nil or false), and returns that value and > doesn't evaluate any of the other expressions, otherwise it returns > the value of the last expr. (and) returns true. > nil > > Notice that and is a macro and that it doesn't expect a sequence as > argument, but rather 0 to multiple expressions (also note that the doc > string appears to have a typo or some sort). So the seq you passed No it does not seem to have any typos in it, but it's quite difficult to parse. It might be clearer if the function name were rendered in italics or bold or something. I'll put it in caps below and reword the last sentence to see if that helps: Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), AND returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. When called without arguments, it returns true. -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: file-seq and recursive directories
On 2 February 2010 10:08, Jeff Rose wrote: > So what would that look like? Is it sufficient to throw every > canonical directory path in a set and test for membership before > traversing down any directory? Yes, I think so, as long as you can fit all of them in memory. The other thing you could do is make sure not to follow symlinks. > Or is that even sufficient because you > could arrive at the same location through different paths... I wonder No, they will all have the same canonical path. That's what canonical means :) > if you can get something more unique, like an inode ID or something > along those lines? The canonical path should be just as unique as the inode number in theory. I don't know how it deals with things like bind mounts etc. in practice, but I don't think that should cause problems, because you can't create loops with bind mounts (AFAIK). Of course the above is Unix-centric. On Windows you might not have inode numbers (VFAT. Not sure if ntfs has an inode number equivalent.) Also, I think I've heard that in Windows you can create hard links to directories, so I don't know how they avoid loops. > On Feb 1, 11:21 pm, ataggart wrote: >> On Feb 1, 2:14 pm, Jim Van Donsel wrote: >> >> > Fair enough. >> >> > But I guess the moral is that a file-seq should not be used unless you >> > have a well-controlled filesystem. >> >> Or more generally, all sequences may be infinite unless you know the >> backing data has no cycles, or you have some terminating/filtering >> conditions. -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: idiomatic question about reader macro
Well, clojure provides a variety of reader macro. In fact I don't think that I would need different ones, but I would like to have them available, simply because I like concise, purpose-built languages. Besides I don't think that user created reader macro would damage because there is practically no need to use them in case of currently-existant macro. As I write, this is only idiomatic question for me. I need them only as a possibility that make the language more concise and maybe one day I will really need them. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: file-seq and recursive directories
So what would that look like? Is it sufficient to throw every canonical directory path in a set and test for membership before traversing down any directory? Or is that even sufficient because you could arrive at the same location through different paths... I wonder if you can get something more unique, like an inode ID or something along those lines? On Feb 1, 11:21 pm, ataggart wrote: > On Feb 1, 2:14 pm, Jim Van Donsel wrote: > > > Fair enough. > > > But I guess the moral is that a file-seq should not be used unless you > > have a well-controlled filesystem. > > Or more generally, all sequences may be infinite unless you know the > backing data has no cycles, or you have some terminating/filtering > conditions. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en