Re: java.io.IOException with compile
Hi, On 4 Feb., 01:03, Stuart Sierra wrote: > Or get another operating system. :) In general this won't help. A quick check on wikipedia gave, that only reiserfs allows for filenames longer than 256 Bytes. (looking at: ext3, ext4, reiserfs, XFS, JFS, HFS+, NTFS; for ufs there was no info, but I think I remember the same limit) 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
XML navigation puzzles
Hello, Can some one show me how to navigate through xml? I am trying to have some fun with clojure and think of doing a simple xml navigation, it seems I didn't get the basics and not know how to do this simple thing in clojure. For example, I try to get the user id and name of all barackobama twitter friends. The following is as far as I can go and not know the best way to retrieve the id and name of each user. (let [users (clojure.xml/parse "http://api.twitter.com/1/statuses/friends/barackobama.xml";)] (:content users) ) The following groovy scripts shows what I am trying to do: def data=new XmlSlurper().parse("http://api.twitter.com/1/statuses/friends/barackobama.xml";) data.user.each{u-> println u.screen_name.text()+" "+u.id.text() } It would do me a big favor to understand clojure if some one could show me how to do the above thing in clojure. Thanks Yiguang -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Hosted REPL, suggestions?
Hi Mark, I don't have answers to your bigger questions, but > question: if GAE is the only game in town, do people have a > preferrence over the various packages available on github (app-magic, > appengine-clj, others)? I've recently moved my apps to appengine-magic. It does a good job of setting up appengine services for local development (and as fixtures for testing) as well as providing clojure wrappers. It also comes with a few helpful leiningen tasks. I realize I only answered a sub-question, but I wanted to plug appengine-magic since I've found it useful and definitely recommend it. Good luck, 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
idiomatic super-map
This is probably a pretty newb question...sorry. I'm looking for the idiomatic way to apply a seq of functions to other seqs. In other words, a version of map that doesn't take a single f, but a seq of them. (map f c1 c2 ... cn) => ((f c11 c21 ... cn1) (f c12 c22 ... cn2) ... (f c1m c2m ... cnm)) (supermap fs c1 c2 ... cn) => ((f1 c11 c21 ... cn1) (f2 c12 c22 ... cn2) ... (fk c1m c2m ... cnm)) Make sense? Before I go reinventing the wheel (map implementation looks hard!), I figured I would ask here...somebody must be doing this already. Thanks in advance. Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: idiomatic super-map
Hi, (map (juxt f1 f2 f3) c1 c2 c3) (map (apply juxt fs) c1 c2 c3) (apply map (apply juxt fs) cs) 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: idiomatic super-map
Or maybe on a second look: (map apply fs c1 ... cn)? (user=> (map #(apply %1 %&) [+ - *] [1 2 3] [1 2 3]) (2 0 9) vs. user=> (map (juxt + - *) [1 2 3] [1 2 3]) ([2 0 1] [4 0 4] [6 0 9]) 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: idiomatic super-map
On Fri, Feb 4, 2011 at 9:19 AM, Mike wrote: > This is probably a pretty newb question...sorry. I'm looking for the > idiomatic way to apply a seq of functions to other seqs. In other > words, a version of map that doesn't take a single f, but a seq of > them. > > (map f c1 c2 ... cn) > => ((f c11 c21 ... cn1) (f c12 c22 ... cn2) ... (f c1m c2m ... cnm)) > > (supermap fs c1 c2 ... cn) > => ((f1 c11 c21 ... cn1) (f2 c12 c22 ... cn2) ... (fk c1m c2m ... > cnm)) > > Make sense? This does it without using juxt: (defn supermap [fs & cs] (map apply fs (apply map vector cs))) With juxt it's as Meikel wrote: (defn supermap [fs & cs] (apply map (apply juxt fs) cs)) user=> (supermap [#(* %1 %2) #(* %1 %2 %2) + -] [1 2 3 4] [5 6 7 8]) (5 72 10 -4) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 super-map
On Fri, Feb 4, 2011 at 10:11 AM, Ken Wesson wrote: > With juxt it's as Meikel wrote: > > (defn supermap [fs & cs] > (apply map (apply juxt fs) cs)) Or not. Hm, juxt documentation needs clarifying. > (defn supermap [fs & cs] > (map apply fs (apply map vector cs))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 super-map
On Feb 4, 10:11 am, Ken Wesson wrote: > This does it without using juxt: > > (defn supermap [fs & cs] > (map apply fs (apply map vector cs))) This is really nice. Even handles infinity properly: (supermap (repeat +) (range 3) (range 3)) => (0 2 4) Thanks Ken and Meikel! Mike -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: XML navigation puzzles
Here is my attempt using enlive: (require '[net.cgrand.enlive-html :as html]) (import '[java.net URL])) (def *url* "http://api.twitter.com/1/statuses/friends/barackobama.xml";) (defn print-friends [url] (let [data (html/xml-resource (URL. url))] (doseq [user (html/select data [:user])] (let [name (html/text (first (html/select user [:screen_name]))) id (html/text (first (html/select user [:id])))] (println (str "username: " name " (" id ")")) (print-friends *url*) username: TruthSeekerZ1 (18346856) username: davidaxelrod (244655353) username: yankee13man (27474384) username: carbo (14171957) username: cadonato (27583520) username: pfeiffer44 (131144091) ... Hope that helps, Allen On Thu, Feb 3, 2011 at 5:25 PM, yiguang hu wrote: > Hello, Can some one show me how to navigate through xml? > > I am trying to have some fun with clojure and think of doing a simple > xml navigation, it seems I didn't get the basics and not know how to > do this simple thing in clojure. > > For example, I try to get the user id and name of all barackobama > twitter friends. The following is as far as I can go and not know the > best way to retrieve the id and name of each user. > > (let [users (clojure.xml/parse > "http://api.twitter.com/1/statuses/friends/barackobama.xml";)] > (:content users) > ) > > The following groovy scripts shows what I am trying to do: > > def data=new > XmlSlurper().parse("http://api.twitter.com/1/statuses/friends/barackobama.xml";) > data.user.each{u-> > println u.screen_name.text()+" "+u.id.text() > } > > It would do me a big favor to understand clojure if some one could > show me how to do the above thing in clojure. > > Thanks > Yiguang > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from 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
Confusion about JARs & Leiningen
Hi everyone: Even though I'm an intermediate clojure user, I realize there's some basic things I just don't understand about JARs and Leiningen. It seems to me the answers to these questions would make great additions to the Leiningen FAQ (unless I'm the only one boneheaded enough not to be able to figure this stuff out on my own :-) 1. What are the sources used for Leiningen JARs? Clearly, clojars.org is one of the sources, but it is able to also pull in jars not on clojars (such as "org.clojure/clojure 1.2.0") and I can't figure out how it decides where these are pulled from (admittedly, I haven't read the lein source, but it seems there should be documentation on this basic info somewhere without needing to study the source.) 2. Maybe the fact that "org.clojure" appears in this package name means "retrieve this package from the site clojure.org". However, clojure is maintained at github, I don't understand why we'd want to pull anything from clojure.org. Is this JAR stored at clojure.org just as a static file in the root of the site or something? How would I know this file exists and that I can reference it? 3. What is the correct way to know what version numbers to use when referencing JARs for Leiningen? For instance, how would I find know that I can use the JAR "org.clojure/clojure 1.2.0" but cant use the JAR "org.clojure/clojure 1.4.0"? How do I know when to append "SNAPSHOT" to the name? I mean, I know that "SNAPSHOT" basically means this is a branch under active development and not stable, but where can I find out what stable and snapshot versions of particular JARs are available? (I'm aware that clojars.org has a search feature, but surely that can't be the whole answer...) Thanks for any clarification on these questions- I hope the answers aren't so simple that I'll feel foolish for asking these things in the first place :-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: XML navigation puzzles
I like to use zip and zip-filter with xml files. For example (suppose clojure.zip is aliased as zip and clojure.contrib.zip-filter.xml is aliased as zf): (def bo-zip (zip/xml-zip (xml/parse "http://api.twitter.com/1/statuses/ friends/barackobama.xml" Then I can use zip-filters to get the info I want. To get all the user id's: (zf/xml-> bo-zip :user :id zf/text) To get screen names: (zf/xml-> bo-zip :user :screen_name zf/text) To get both at once, use juxt (normally I would give the filters names ahead of time, to improve readablity): ((juxt #(zf/xml-> % :user :id zf/text) #(zf/xml-> % :user :screen_name zf/text)) bo-zip) That gives you a vector of two lists. You could interleave them, and turn them into a hash map, or deal with them as is. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Matrix transform
I've got a matrix transformation that I'm doing which is really slow. I'm looking for ways to speed it up. source is a NxD matrix (seqs of seqs of values). I will set and read this matrix. dest is a NxN transformation of f in which indices are mapped to specific indices of f. I will only read this matrix, not set it. If I place a value in one cell of source, it may show up in 30 other places in dest due to a mapping function. I then use dest for some simple matrix operations. The mapping that I use is generated once, however it has to be applied to the source very frequently. Is there any way I could define dest with memory locations that correspond to the mapped locations of source? This would allow me to define the mapping once. Subsequently I could simply set source and read dest with the changes already propagated. I've thought about using seqs of seqs of refs in source, then assigning those same refs to the mapped locations of dest, but I'm not sure if there is some other overhead hit I would take from setting and reading the refs. What is the right solution? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion about JARs & Leiningen
These are all questions about Maven, the dependency management / build system used by many Java developers, on top of which leiningen is built. 1. The sources are publicly accessible maven repositories, of which clojars is one. When running 'lein deps', you can see the repositories that leiningen is checking for artifacts. You can also specify additional repositories in your project.clj with the :repositories option. 2. 'org.clojure' is the group id, and 'clojure 1.2.0' is the artifact id. This becomes clearer when viewing Maven's .pom xml files. 3. Version numbers are referenced all over the place. I will often search mvnrepository.com if I am looking for available versions of Java packages, or clojars.org for clojure packages. On Fri, Feb 4, 2011 at 11:30 AM, Conrad wrote: > Hi everyone: Even though I'm an intermediate clojure user, I realize > there's some basic things I just don't understand about JARs and > Leiningen. It seems to me the answers to these questions would make > great additions to the Leiningen FAQ (unless I'm the only one > boneheaded enough not to be able to figure this stuff out on my > own :-) > > 1. What are the sources used for Leiningen JARs? Clearly, clojars.org > is one of the sources, but it is able to also pull in jars not on > clojars (such as "org.clojure/clojure 1.2.0") and I can't figure out > how it decides where these are pulled from (admittedly, I haven't read > the lein source, but it seems there should be documentation on this > basic info somewhere without needing to study the source.) > > 2. Maybe the fact that "org.clojure" appears in this package name > means "retrieve this package from the site clojure.org". However, > clojure is maintained at github, I don't understand why we'd want to > pull anything from clojure.org. Is this JAR stored at clojure.org just > as a static file in the root of the site or something? How would I > know this file exists and that I can reference it? > > 3. What is the correct way to know what version numbers to use when > referencing JARs for Leiningen? For instance, how would I find know > that I can use the JAR "org.clojure/clojure 1.2.0" but cant use the > JAR "org.clojure/clojure 1.4.0"? How do I know when to append > "SNAPSHOT" to the name? I mean, I know that "SNAPSHOT" basically means > this is a branch under active development and not stable, but where > can I find out what stable and snapshot versions of particular JARs > are available? (I'm aware that clojars.org has a search feature, but > surely that can't be the whole answer...) > > Thanks for any clarification on these questions- I hope the answers > aren't so simple that I'll feel foolish for asking these things in the > first place :-) > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from 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: Confusion about JARs & Leiningen
On Fri, 4 Feb 2011 08:30:21 -0800 (PST) Conrad wrote: > Hi everyone: Even though I'm an intermediate clojure user, I realize > there's some basic things I just don't understand about JARs and > Leiningen. It seems to me the answers to these questions would make > great additions to the Leiningen FAQ (unless I'm the only one > boneheaded enough not to be able to figure this stuff out on my > own :-) > > 1. What are the sources used for Leiningen JARs? Clearly, clojars.org > is one of the sources, but it is able to also pull in jars not on > clojars (such as "org.clojure/clojure 1.2.0") and I can't figure out > how it decides where these are pulled from (admittedly, I haven't read > the lein source, but it seems there should be documentation on this > basic info somewhere without needing to study the source.) It has a number of default repositories that it searches. You can add more using the :repositories keyword. It's a hash map, key being the repo name you choose and the value the url. > > 2. Maybe the fact that "org.clojure" appears in this package name > means "retrieve this package from the site clojure.org". However, > clojure is maintained at github, I don't understand why we'd want to > pull anything from clojure.org. Is this JAR stored at clojure.org just > as a static file in the root of the site or something? How would I > know this file exists and that I can reference it? If you need a jar file to be pumped by leiningen, you need access to its pom.xml. You can either search Maven repositories or just google something like pom.xml. You look a the pom.xml, you need [group/artifactid "version"] in the dependencies list in your project.clj. Then let leinigen search for it. If it does not find it then either you need to add a repository that is not part of the default repo list of leiningen or you may have to publish it in your own repo if the project maintainers of the library you need did not publish it somewhere. You can also publish it in clojars but you have to follow some rules if it's not your own project. > > 3. What is the correct way to know what version numbers to use when > referencing JARs for Leiningen? For instance, how would I find know > that I can use the JAR "org.clojure/clojure 1.2.0" but cant use the > JAR "org.clojure/clojure 1.4.0"? How do I know when to append > "SNAPSHOT" to the name? I mean, I know that "SNAPSHOT" basically means > this is a branch under active development and not stable, but where > can I find out what stable and snapshot versions of particular JARs > are available? (I'm aware that clojars.org has a search feature, but > surely that can't be the whole answer...) > Welcome to the world of dependency management... Some but not all pom.xml will have a section listing dependencies. Some will be flagged as required while others are optional. Each dependency states it's group, artifact is and version. Leiningen will pull these also. With other libraries, you may have to refer to the project home site to find out what extra components are needed and then add these to your dependency list. > Thanks for any clarification on these questions- I hope the answers > aren't so simple that I'll feel foolish for asking these things in the > first place :-) > -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 print-dup records?
cool! thought you had to refer or something the namespace, but i guess the reader works differently. changes are here https://github.com/Storkle/defrecord2 basically, i modified it to work with print-dup and i got rid of the pprint methods and changed the way constructor names are specified. so now (defrecord2 (hi my-constructor) [a b] Protocol1 ) and (my-constructor {:a 2 :b 3}) (pprint a-record) ;pprints like a normal record but (binding [*print-dup* true] (print-str (my-constructor {:a 2}))) will output something like this #=(my.namespace/my-constructor .) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Matrix transform
Could you possibly put up a minimal example of code that shows the problem? I'm having a hard time following exactly what you're doing but would like to help. :) sincerely, --Robert McIntyre On Fri, Feb 4, 2011 at 10:20 AM, Nick wrote: > I've got a matrix transformation that I'm doing which is really slow. > I'm looking for ways to speed it up. > > source is a NxD matrix (seqs of seqs of values). I will set and read > this matrix. > dest is a NxN transformation of f in which indices are mapped to > specific indices of f. I will only read this matrix, not set it. > > If I place a value in one cell of source, it may show up in 30 other > places in dest due to a mapping function. I then use dest for some > simple matrix operations. The mapping that I use is generated once, > however it has to be applied to the source very frequently. > > Is there any way I could define dest with memory locations that > correspond to the mapped locations of source? This would allow me to > define the mapping once. Subsequently I could simply set source and > read dest with the changes already propagated. > > I've thought about using seqs of seqs of refs in source, then > assigning those same refs to the mapped locations of dest, but I'm not > sure if there is some other overhead hit I would take from setting and > reading the refs. > > What is the right solution? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from 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: XML navigation puzzles
Thanks a lot for both responses. I really appreciate it! The zip is really nice. On Fri, Feb 4, 2011 at 11:39 AM, Despite wrote: > I like to use zip and zip-filter with xml files. For example (suppose > clojure.zip is aliased as zip and clojure.contrib.zip-filter.xml is > aliased as zf): > > (def bo-zip (zip/xml-zip (xml/parse "http://api.twitter.com/1/statuses/ > friends/barackobama.xml" > > Then I can use zip-filters to get the info I want. To get all the > user id's: > > (zf/xml-> bo-zip :user :id zf/text) > > To get screen names: > > (zf/xml-> bo-zip :user :screen_name zf/text) > > To get both at once, use juxt (normally I would give the filters names > ahead of time, to improve readablity): > > ((juxt #(zf/xml-> % :user :id zf/text) #(zf/xml-> % :user :screen_name > zf/text)) bo-zip) > > That gives you a vector of two lists. You could interleave them, and > turn them into a hash map, or deal with them as is. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from 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: java interop question
Yes, Ken's original suggestion was correct -- the clojure code had to look like a real java bean. It works perfectly now, so thanks! On Feb 3, 3:55 pm, Stuart Sierra wrote: > I don't know what "select * from StockTick(symbol=..." is doing, but it > looks like the error is coming from the library handling that query, not > Clojure. > > -Stuart Sierra > clojure.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: Matrix transform
If you need efficient numeric matrix operations, your best bet is to move away from higher level abstractions like seqs and (especially) refs and just use a one-dimensional Java array of primitives of size (* m n), and indexed as (+ (* i m) j) or (+ (* j n) i) using primitive arithmetic for speed. You can, of course, use macros or even definlines to create an abstraction over this implementation while still retaining the speed (and the use of primitive math). If you're using 1.3 alpha, you can also pass primitives through normal function calls, which may help (but you'll have to use long instead of int, which may hinder, since Java array indices must be int forcing a coercion and since long arithmetic may be slower on some 32-bit hardware than int arithmetic). In particular, using a 1D array of primitives keeps the entire matrix in one contiguous block of RAM, versus a 2D array (which may have your rows (or columns) scattered randomly about the heap) or an array of boxed values (which may have the values themselves scattered randomly about the heap). The memory access pattern with the 1D array of primitives will improve cache performance, and especially should improve performance if there's any paging by the OS. Of course, using a mutable array carries all the peril and pitfalls of unsynchronized mutable values, as well as the speed potential. Your abstraction layer should do fairly high level jobs (such as row reduction) with mutable temp matrices while avoiding mutating their arguments, and should shield user-visible matrices (and vectors) from being mutated, so that to the caller of the library the objects seem immutable. You'll probably want three components: low level macros for the basic operations like indexing into the matrix and getting and setting cells; macro analogues of common functional operations like map and reduce (built off areduce perhaps; with code bodies instead of function arguments); and higher level functions that provide the real API and use these lower level components to perform tasks like multiplication, row reduction, and whatever other operations you need to perform. Then make your application a caller of this library. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion about JARs & Leiningen
Thanks guys for the informative replies! -Conrad On Feb 4, 11:30 am, Conrad wrote: > Hi everyone: Even though I'm an intermediate clojure user, I realize > there's some basic things I just don't understand about JARs and > Leiningen. It seems to me the answers to these questions would make > great additions to the Leiningen FAQ (unless I'm the only one > boneheaded enough not to be able to figure this stuff out on my > own :-) > > 1. What are the sources used for Leiningen JARs? Clearly, clojars.org > is one of the sources, but it is able to also pull in jars not on > clojars (such as "org.clojure/clojure 1.2.0") and I can't figure out > how it decides where these are pulled from (admittedly, I haven't read > the lein source, but it seems there should be documentation on this > basic info somewhere without needing to study the source.) > > 2. Maybe the fact that "org.clojure" appears in this package name > means "retrieve this package from the site clojure.org". However, > clojure is maintained at github, I don't understand why we'd want to > pull anything from clojure.org. Is this JAR stored at clojure.org just > as a static file in the root of the site or something? How would I > know this file exists and that I can reference it? > > 3. What is the correct way to know what version numbers to use when > referencing JARs for Leiningen? For instance, how would I find know > that I can use the JAR "org.clojure/clojure 1.2.0" but cant use the > JAR "org.clojure/clojure 1.4.0"? How do I know when to append > "SNAPSHOT" to the name? I mean, I know that "SNAPSHOT" basically means > this is a branch under active development and not stable, but where > can I find out what stable and snapshot versions of particular JARs > are available? (I'm aware that clojars.org has a search feature, but > surely that can't be the whole answer...) > > Thanks for any clarification on these questions- I hope the answers > aren't so simple that I'll feel foolish for asking these things in the > first place :-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Hosted REPL, suggestions?
Thanks to one and all for the replies. For the moment, I'm going to concentrate on the DSL itself and start puttering with a Clojure parser for CodeMirror (http://codemirror.net/), a JavaScript text editor, which should be simplified by cribbing from the Scheme parser implementation. This is something that could be immediately useful for tryclojure. Best wishes, -Mark -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
searching for a good name thread-let, thread-with, thread-thru
Clojure's threading macros -> and ->> to be quite a win. It breaks down when the expression to be chained together are not consistent in nesting the threaded expression second or last. An idiomatic way to gain the necessary flexibility seems to be via let: (let [x (line-seq x) x (sort x) ...] x) I've never been very happy with that solution. The same variable appears multiple times in the same let. Maybe that just confuses my Scheme sensibilities. (I know there are previously been discussions about a variant of -> which allows the threading position to be marked in some way, though these never really went anywhere. I also rejected the alternative of using an anaphoric macro which always uses 'it or '$ or some such as the name to thread through. That didn't seem very Clojuresque.) I came up with this macro, but I'm unsure what to call it: (defmacro thread-let [[varname init-expression :as binding] & expressions] {:pre [(symbol? varname) (not (namespace varname)) (vector? binding) (= 2 (count binding))]} `(let [~@(interleave (repeat varname) (cons init-expression expressions))] ~varname)) usage example: (thread-let [x (initial-value)] (foo x 3) (bar 1 2 x)) which is equivalent to: (let [x (initial-value) x (foo x 3) x (bar 1 2 x)] x) What should I name this thing? I'm concerned that "thread" is confusing due to its dual meaning. let seems in line with clojure conventions. (thread-let [x ...] ...) (thread-with [x ...] ...) (thread-through [x ...] ...) (let-> [x ...] ...) thoughts? // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: searching for a good name thread-let, thread-with, thread-thru
On Fri, Feb 4, 2011 at 3:05 PM, B Smith-Mannschott wrote: > (defmacro thread-let [[varname init-expression :as binding] & expressions] > {:pre [(symbol? varname) > (not (namespace varname)) > (vector? binding) > (= 2 (count binding))]} > `(let [~@(interleave (repeat varname) (cons init-expression expressions))] > ~varname)) Cl. :) > What should I name this thing? I'm concerned that "thread" is > confusing due to its dual meaning. let seems in line with clojure > conventions. > > (thread-let [x ...] ...) > (thread-with [x ...] ...) > (thread-through [x ...] ...) > (let-> [x ...] ...) > > thoughts? How about (chain [x ...] ...) since it's chaining a sequence of operations together? It's a short, reasonably descriptive name and it doesn't shadow anything in clojure.core. :) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: searching for a good name thread-let, thread-with, thread-thru
Another solution, which is not especially satisfying but is worth considering, is to use the most-common thread style at the top level, and interweave some exceptions for the less-common style. (-> 10 range 20 (->> take 2)) or (->> 10 (#(range % 20)) (take 2)) On Feb 4, 12:05 pm, B Smith-Mannschott wrote: > Clojure's threading macros -> and ->> to be quite a win. It breaks > down when the expression to be chained together are not consistent in > nesting the threaded expression second or last. An idiomatic way to > gain the necessary flexibility seems to be via let: > > (let [x (line-seq x) > x (sort x) > ...] > x) > > I've never been very happy with that solution. The same variable > appears multiple times in the same let. Maybe that just confuses my > Scheme sensibilities. (I know there are previously been discussions > about a variant of -> which allows the threading position to be marked > in some way, though these never really went anywhere. I also rejected > the alternative of using an anaphoric macro which always uses 'it or > '$ or some such as the name to thread through. That didn't seem very > Clojuresque.) > > I came up with this macro, but I'm unsure what to call it: > > (defmacro thread-let [[varname init-expression :as binding] & expressions] > {:pre [(symbol? varname) > (not (namespace varname)) > (vector? binding) > (= 2 (count binding))]} > `(let [~@(interleave (repeat varname) (cons init-expression expressions))] > ~varname)) > > usage example: > > (thread-let [x (initial-value)] > (foo x 3) > (bar 1 2 x)) > > which is equivalent to: > > (let [x (initial-value) > x (foo x 3) > x (bar 1 2 x)] > x) > > What should I name this thing? I'm concerned that "thread" is > confusing due to its dual meaning. let seems in line with clojure > conventions. > > (thread-let [x ...] ...) > (thread-with [x ...] ...) > (thread-through [x ...] ...) > (let-> [x ...] ...) > > thoughts? > > // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: searching for a good name thread-let, thread-with, thread-thru
Missing some parens there. Should be (->> (take 2)), of course. On Feb 4, 12:53 pm, Alan wrote: > Another solution, which is not especially satisfying but is worth > considering, is to use the most-common thread style at the top level, > and interweave some exceptions for the less-common style. > > (-> 10 > range 20 > (->> take 2)) > or > (->> 10 > (#(range % 20)) > (take 2)) > > On Feb 4, 12:05 pm, B Smith-Mannschott wrote: > > > Clojure's threading macros -> and ->> to be quite a win. It breaks > > down when the expression to be chained together are not consistent in > > nesting the threaded expression second or last. An idiomatic way to > > gain the necessary flexibility seems to be via let: > > > (let [x (line-seq x) > > x (sort x) > > ...] > > x) > > > I've never been very happy with that solution. The same variable > > appears multiple times in the same let. Maybe that just confuses my > > Scheme sensibilities. (I know there are previously been discussions > > about a variant of -> which allows the threading position to be marked > > in some way, though these never really went anywhere. I also rejected > > the alternative of using an anaphoric macro which always uses 'it or > > '$ or some such as the name to thread through. That didn't seem very > > Clojuresque.) > > > I came up with this macro, but I'm unsure what to call it: > > > (defmacro thread-let [[varname init-expression :as binding] & expressions] > > {:pre [(symbol? varname) > > (not (namespace varname)) > > (vector? binding) > > (= 2 (count binding))]} > > `(let [~@(interleave (repeat varname) (cons init-expression expressions))] > > ~varname)) > > > usage example: > > > (thread-let [x (initial-value)] > > (foo x 3) > > (bar 1 2 x)) > > > which is equivalent to: > > > (let [x (initial-value) > > x (foo x 3) > > x (bar 1 2 x)] > > x) > > > What should I name this thing? I'm concerned that "thread" is > > confusing due to its dual meaning. let seems in line with clojure > > conventions. > > > (thread-let [x ...] ...) > > (thread-with [x ...] ...) > > (thread-through [x ...] ...) > > (let-> [x ...] ...) > > > thoughts? > > > // Ben > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: searching for a good name thread-let, thread-with, thread-thru
On Fri, Feb 4, 2011 at 12:05, B Smith-Mannschott wrote: > I came up with this macro, but I'm unsure what to call it: > > (defmacro thread-let [[varname init-expression :as binding] & expressions] > {:pre [(symbol? varname) > (not (namespace varname)) > (vector? binding) > (= 2 (count binding))]} > `(let [~@(interleave (repeat varname) (cons init-expression expressions))] > ~varname)) > > Hah, you have been working on one of my frustrations! Thanks! I like (thread-with sym & forms) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Hosted REPL, suggestions?
Exciting. Keep me updated. On Feb 4, 1:39 pm, Mark Fredrickson wrote: > Thanks to one and all for the replies. For the moment, I'm going to > concentrate on the DSL itself and start puttering with a Clojure > parser for CodeMirror (http://codemirror.net/), a JavaScript text > editor, which should be simplified by cribbing from the Scheme parser > implementation. This is something that could be immediately useful for > tryclojure. > > Best wishes, > -Mark -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: searching for a good name thread-let, thread-with, thread-thru
On Fri, 04 Feb 2011 15:05:39 -0500, B Smith-Mannschott wrote: What should I name this thing? I'm concerned that "thread" is confusing due to its dual meaning. let seems in line with clojure conventions. (thread-let [x ...] ...) (thread-with [x ...] ...) (thread-through [x ...] ...) (let-> [x ...] ...) I used let-> for a slightly different version of this in pallet (-> 3 (let-> [x 1 y 2] (+ x y))) => 6 which enables a general let in the middle of a threaded expression. https://github.com/pallet/pallet/blob/master/src/pallet/thread_expr.clj -- Hugo Duncan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion about JARs & Leiningen
On Feb 4, 11:06 am, Conrad wrote: > Thanks guys for the informative replies! Probably also worth reading the tutorial (lein help tutorial in recent versions) as it covers these questions in more depth. -Phil -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Any news on pull requests?
In June 2009, Rich wrote in "clojure goes git!": > Some items are still outstanding: > > Importation of existing issues > Placement of generated contrib documentation > Patch submission policy > > In particular, please don't send pull requests via GitHub at this > time. Any updates there? I really would like to contribute to clojure- contrib the github way. Furthermore, I was really surprised to find on http://clojure.org/contributing that I have to send a (non-e)mail around the world to be able to contribute (for the younger readers: http://simple.wikipedia.org/wiki/Mail has a pretty good explanation of what that was). Can't we agree to those terms by pushing a (pull request) button? Cheers Eugen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote: > Furthermore, I was really surprised to find on http://clojure.org/contributing > that I have to send a (non-e)mail around the world to be able to > contribute Written acceptance of a contributor's agreement is fairly common on large open source projects so that there is legal clearance for inclusion of your contribution under the terms of the project license. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Feb 5, 11:00 am, Sean Corfield wrote: > On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote: > > Furthermore, I was really surprised to find > > onhttp://clojure.org/contributing > > that I have to send a (non-e)mail around the world to be able to > > contribute > > Written acceptance of a contributor's agreement is fairly common on > large open source projects so that there is legal clearance for > inclusion of your contribution under the terms of the project license. Is it really necessary, though? We all agree to EULAs and make other more significant legal commitments online all the time, and in some cases without having proven who and where we are. Otoh, I guess Rich hasn't done this because he likes receiving mails... Or maybe he is indeed a stamp collector? And clojure CAs is just his way of attracting more stamps? ;) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Fri, 4 Feb 2011 18:00:24 -0800 Sean Corfield wrote: > On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote: > > Furthermore, I was really surprised to find on > > http://clojure.org/contributing > > that I have to send a (non-e)mail around the world to be able to > > contribute > Written acceptance of a contributor's agreement is fairly common on > large open source projects so that there is legal clearance for > inclusion of your contribution under the terms of the project license. I find it funny that it takes more paper to sign up as a clojure contributor, which apparently has no benefits to me except bragging rights, than it did to get my Chickasaw Nation citizenship, which has benefits like scholarships, clothing grants for my school-age children, school & housing grants, and of course, voting in tribal elections. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Any news on pull requests?
On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote: > Is it really necessary, though? We all agree to EULAs and make other > more significant legal commitments online all the time, and in some > cases without having proven who and where we are. There are certainly some legal transactions that do not accept electronic "agreements" and require a physical signature. IANAL so I looked up US copyright law and found this paragraph about transfers in Circular 1 (from here http://www.copyright.gov/help/faq/faq-assignment.html ): "Any or all of the copyright owner’s exclusive rights or any subdivision of those rights may be transferred, but the transfer of exclusive rights is not valid unless that transfer is in writing and signed by the owner of the rights conveyed or such owner’s duly authorized agent. Transfer of a right on a nonexclusive basis does not require a written agreement." So that's why a written signature is required for the Clojure CA. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Fri, Feb 4, 2011 at 9:36 PM, Sean Corfield wrote: > On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote: >> Is it really necessary, though? We all agree to EULAs and make other >> more significant legal commitments online all the time, and in some >> cases without having proven who and where we are. > > There are certainly some legal transactions that do not accept > electronic "agreements" and require a physical signature. > > IANAL so I looked up US copyright law and found this paragraph about > transfers in Circular 1 (from here > http://www.copyright.gov/help/faq/faq-assignment.html ): > > "Any or all of the copyright owner’s exclusive rights or any > subdivision of those rights may be transferred, but the transfer of > exclusive rights is not valid unless that transfer is in writing and > signed by the owner of the rights conveyed or such owner’s duly > authorized agent. Transfer of a right on a nonexclusive basis does not > require a written agreement." > > So that's why a written signature is required for the Clojure CA. It says "Transfer of a right on a nonexclusive basis does not require a written agreement". As long as Clojure gets a worldwide, nonexclusive, royalty-free license with EPL-compatible redistribution terms, that ought to be good enough, shouldn't it? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Any news on pull requests?
On Fri, 4 Feb 2011 18:36:34 -0800 Sean Corfield wrote: > On Fri, Feb 4, 2011 at 6:16 PM, Eugen Dück wrote: > > Is it really necessary, though? We all agree to EULAs and make other > > more significant legal commitments online all the time, and in some > > cases without having proven who and where we are. > > There are certainly some legal transactions that do not accept > electronic "agreements" and require a physical signature. > > IANAL so I looked up US copyright law and found this paragraph about > transfers in Circular 1 (from here > http://www.copyright.gov/help/faq/faq-assignment.html ): > > "Any or all of the copyright owner’s exclusive rights or any > subdivision of those rights may be transferred, but the transfer of > exclusive rights is not valid unless that transfer is in writing and > signed by the owner of the rights conveyed or such owner’s duly > authorized agent. Transfer of a right on a nonexclusive basis does not > require a written agreement." > > So that's why a written signature is required for the Clojure CA. Um, read the last line in the quote, about "nonexclusive basis". The first bullet of clause two in the CA (downloaded just now) grants Rich Hickey a "... perpetual, irrevocable, non-exclusive, worldwide ... license" Given that the license is nonexclusive transfer (and I have to wonder if you'd get any contributors otherwise, or if any other OSS project has an exclusive transfer), then according to that last line, it "does not require a written agreement." IANAL either, but it sure seems like the current requirements exceeds what the law requires. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Any news on pull requests?
On Fri, Feb 4, 2011 at 6:39 PM, Ken Wesson wrote: > It says "Transfer of a right on a nonexclusive basis does not require > a written agreement". As long as Clojure gets a worldwide, > nonexclusive, royalty-free license with EPL-compatible redistribution > terms, that ought to be good enough, shouldn't it? That made me pull up the Clojure CA and it is worded in terms of 'non-exclusive' so it would seem that a written agreement is not actually _required_ by US law, at least insofar as the copyright portion is concerned. The CA also covers patents and some other things and I'm not inclined to go research that aspect of law. Frankly, I think more time is spent discussing the pros and cons of the CA than would actually be spent just filling it in and mailing it off to Rich... If someone really feels signing and mailing an agreement is "too much work" then they don't seem very committed to contributing, IMO. It's really not much of a hardship is it? My signed CA is on file with Rich so, for me at least, it's a moot point :) -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Feb 5, 11:51 am, Sean Corfield wrote: > off to Rich... If someone really feels signing and mailing an > agreement is "too much work" then they don't seem very committed to > contributing, IMO. It's really not much of a hardship is it? Things like github's pull requests are really great, as they are lowering the barriers for both the contributor to contribute as well as for the maintainer to review and merge in changes. And although the physical CA is 'orthogonal' to pull requests - btw. my real question here - it is setting up a barrier. If you'd have to sign and send mails for every open source project you want to contribute to, it would be pretty annoying. Not everyone is a main contributor to every project they have a small patch for. That said, clojure for me surely is a project that could convince me to send out that form, but I'm not that big a stamp donor these days. > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood So chances are I'm "really alive". -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Fri, Feb 4, 2011 at 9:51 PM, Sean Corfield wrote: > On Fri, Feb 4, 2011 at 6:39 PM, Ken Wesson wrote: >> It says "Transfer of a right on a nonexclusive basis does not require >> a written agreement". As long as Clojure gets a worldwide, >> nonexclusive, royalty-free license with EPL-compatible redistribution >> terms, that ought to be good enough, shouldn't it? > > That made me pull up the Clojure CA and it is worded in terms of > 'non-exclusive' so it would seem that a written agreement is not > actually _required_ by US law, at least insofar as the copyright > portion is concerned. The CA also covers patents and some other things > and I'm not inclined to go research that aspect of law. > > Frankly, I think more time is spent discussing the pros and cons of > the CA than would actually be spent just filling it in and mailing it > off to Rich... If someone really feels signing and mailing an > agreement is "too much work" then they don't seem very committed to > contributing, IMO. It's really not much of a hardship is it? Perhaps. But it's well known that any barrier to participation causes a percentage drop in same. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
force evaluation of macro parameter
I'm using a macro that, stripped down to just expose my problem, looks like this: (defmacro quoted-param [x] `(println '~x)) It's all nice if I call it like (quoted-param 23) It will print the number 23. The following, however, will print "asdf", rather than 23: (def asdf 23) (quoted-param asdf) Which is of course what the quote is supposed to do. But is there any way to get that macro to expand to using the value of asdf, rather than the symbol itself? Or can only changing the macro fix this? I fear the latter, which would imply that using quotes like that in a macro should be done with great care, I guess. Adding a quote when 'calling' the macro is easy... Cheers Eugen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: force evaluation of macro parameter
On Fri, Feb 4, 2011 at 11:24 PM, Eugen Dück wrote: > I'm using a macro that, stripped down to just expose my problem, looks > like this: > > (defmacro quoted-param > [x] > `(println '~x)) > > It's all nice if I call it like > > (quoted-param 23) > > It will print the number 23. The following, however, will print > "asdf", rather than 23: > > (def asdf 23) > (quoted-param asdf) > > Which is of course what the quote is supposed to do. But is there any > way to get that macro to expand to using the value of asdf, rather > than the symbol itself? Or can only changing the macro fix this? I > fear the latter, which would imply that using quotes like that in a > macro should be done with great care, I guess. Adding a quote when > 'calling' the macro is easy... Why not just ~x rather than '~x? If you want the param evaluated, you normally just unquote it with ~. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: force evaluation of macro parameter
>> Which is of course what the quote is supposed to do. But is there any >> way to get that macro to expand to using the value of asdf, rather >> than the symbol itself? Or can only changing the macro fix this? I >> fear the latter, which would imply that using quotes like that in a >> macro should be done with great care, I guess. Adding a quote when >> 'calling' the macro is easy... > > Why not just ~x rather than '~x? If you want the param evaluated, you > normally just unquote it with ~. Because Eugen is trying to use an existing macro in a different way than it was originally intended, without changing the original macro. This makes me think that the original macro needs some refactoring. There should be a function that handles most of the work, and a macro to make your code shorter in the common case. (defn unquoted-param [x] (println x)) (defmacro quoted-param [x] `(unquoted-param '~x)) Of course, this looks silly because unquoted-param is just println, but I assume your real situation has a bit more to it. In general, you should try to use functions more often macros. Even when a macro is needed, it's still often best to let a function do most of the work. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Which branch of clojure-hadoop to use?
I have a bunch of older computers sitting at home, and thought I'd put them to use for experimenting with clojure-hadoop and swarmiji. However, I can't figure out which branch of clojure-hadoop to use. Stuart Sierra's branch looks like the canonical one, but hasn't been updated since March 2010. alexott's branch looks to be the most frequently updated, but there are also more recent branches from eslick and clizzin. If someone could shed light on this situation, that'd be greatly appreciated! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: force evaluation of macro parameter
On Feb 5, 1:52 pm, Eric Lavigne wrote: > This makes me think that the original macro needs some refactoring. > There should be a function that handles most of the work, and a macro > to make your code shorter in the common case. > > (defn unquoted-param [x] (println x)) > > (defmacro quoted-param [x] `(unquoted-param '~x)) > > Of course, this looks silly because unquoted-param is just println, > but I assume your real situation has a bit more to it. In general, you > should try to use functions more often macros. Even when a macro is > needed, it's still often best to let a function do most of the work. Thanks Eric, yes, the code is more complex and it is in contrib. Changing contrib requires you to send an intercontinental mail first, as mentioned in my other post today... :) Reason enough to first checkout the other options and dig deeper into macros. Will for now just try to solve it in my contrib fork. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Any news on pull requests?
On Fri, Feb 4, 2011 at 10:35 PM, Ken Wesson wrote: > Perhaps. But it's well known that any barrier to participation causes > a percentage drop in same. This topic keeps coming up, and while a large number of people have signed CAs (many of us at the conference last year), people keep citing it as some unique requirement foisted upon the community by a power hungry dictator -- or something like that. The truth of the matter is that different "open source" projects maintain differing levels of IP stewardship. Some are quite lax, and some are quite strict. Often, the older the project, and the "higher profile" it is, the more likely it is to maintain some level of IP control. That many project don't do this is not a sign of crowd-wisdom. For example, the following projects REQUIRE contributor agreements, in writing, signed and either scanned or on paper, prior to accepting any patches or commits: - Free Software Foundation - Apache, and everything under it - Python - Perl - Django - MySQL - Node.js - Fedora Linux - Neo4j - Sun (now Oracle) That was a combination of the ones I have on record that I've signed over the years, and the result of a few seconds searching. I don't think most of those have found much trouble in flourishing as a true open source community. Now, I'm not passing judgement on whether these are "good for community", but as someone who has had to deal with the legal ramifications of tainted IP, I can tell you it's something that you do not want to have to deal with. It is expensive, and the only people that win are the lawyers. If you want to see a community destroyed, drag it into the legal system for a good thrashing. Do you want to explain to a judge who doesn't know how to use email that your pull-request was the same? Trust me, you don't. Especially when your opponent often has 10-10,000x the financial resources. The legal system in the United States, where Clojure is covered, has moved very slowly and in very mixed ways around click-thru, shrink-wrap and other license/agreement styles that do not require an explicit signature. It may be a sad state of the system, but it is the state of the system none-the-less. Even "electronic signatures" exist in a fragmented and rather poorly understood legal area unless it involves cryptographic keys that can be traced back. Being cautious, when it comes to intellectual property protection, is simply being wise. Yes, it diffuses a small amount of "pain" now, but in exchange for the elimination of a lot of risk later. Now, someone could provide a way to have them faxed, or scanned and emailed, rather than paper, and that might reduce the "pain" a little, but the reality is, your John Hancock is worth more in a court of law than any 500 check boxes on a form. Legal agreements, such as these, transfer liability. If Rich, or whomever, were to accept a contribution via a pull-request, without having an accompanying document he can point to that says "I am the sole owner of this intellectual property", it would be possible to contaminate the entire code base. I know it sounds paranoid, but when distilled, that's what the legal system is ... structured paranoia. 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: force evaluation of macro parameter
On Sat, Feb 5, 2011 at 12:08 AM, Eugen Dück wrote: > yes, the code is more complex and it is in contrib. Changing contrib > requires you to send an intercontinental mail first, as mentioned in > my other post today... :) Reason enough to first checkout the other > options and dig deeper into macros. > > Will for now just try to solve it in my contrib fork. Which macro is it and what are you trying to do with it? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Deflayout - define Swing UI declaratively
That's not how macros work. They can only operate on the parameters they're passed, as symbols and lists. If you prepare a value for them elsewhere, those values will only be available in the macroexpansion (runtime), not at compile time. Granted, it would be nice if the functionality were exposed as functions as well as macros, but that's harder and has to be done at runtime (leading to the perception of "slow java"). But you definitely don't want to make a macro work the way you suggest. On Feb 3, 8:12 pm, Vagif Verdi wrote: > It would be better if your macro would accept maps and vectors, > because those can be prepared somewhere else and passed around as > parameters. Your current macro allows only hardcoding. > > On Feb 3, 4:23 pm, Alexander Yakushev wrote: > > > >(deflayout frame > > >{:west gamepanel > > >:east (deflayout sidepanel > > >[nextpanel (JButton. "Exit")] :flow :trailing)) > > > Actually I thought about something like that, but then I decided to come > > up with something at least a bit uniform. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Deflayout - define Swing UI declaratively
On Sat, Feb 5, 2011 at 1:01 AM, Alan wrote: > That's not how macros work. They can only operate on the parameters > they're passed, as symbols and lists. Clojure macros can also see literal maps, sets, and vectors, not to mention integers, strings, and the like. (Ever seen "IllegalArgumentException: let requires a vector for its binding" or similarly?) user=> (defmacro foo [x] `(println ~x "was a" ~(type x))) #'user/foo user=> (def a 42) #'user/a user=> (foo []) [] was a clojure.lang.PersistentVector nil user=> (foo #{}) #{} was a clojure.lang.PersistentHashSet nil user=> (foo {}) {} was a clojure.lang.PersistentArrayMap nil user=> (foo a) 42 was a clojure.lang.Symbol nil user=> (foo 42) 42 was a java.lang.Integer nil user=> (foo "bar") bar was a java.lang.String 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