Re: Let usage question
Dave, Yes, this is perfectly idiomatic and many people in Clojure (and also Haskell, for example) use let to help document how they're building up their computation. Stuart's suggestion is also good and it's largely a matter of personal preference which to use when. Of course, as you use clojure more, you'll probably become more comfortable with more complex statements and not use the let style quite so much. Tom On Oct 19, 8:19 pm, Dave Ray wrote: > Hey, > > I'm parsing a file with a chain of filter and map operations. To make > it a little more readable (to me), I put the steps in a let like this: > > (defn parse-dictionary > [reader] > (let [lines (read-lines reader) > trimmed (map #(.trim %1) lines) > filtered (filter is-dictionary-entry? trimmed)] > (map parse-entry filtered))) > > Is this style of let considered good/bad stylistically? Are there > technical tradeoffs between this and a bunch of nested forms? > > Thanks! > > Dave -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Help to optimize palindrome search from input file
someone posted a 200,000 char test-string: http://pastebin.com/raw.php?i=a8veAND3 (doesn't view properly in chrome, view-source and save) and the previous code failed pretty hard.. so, new approach - one pass has all the information on where each character occurs. so, create a map with each character as key having value as list of indices where the character occurs - test for palindrome between these indices for each key(character) - keep track of current-largest-palindrome and ignore strings smaller than that code: http://clojure.pastebin.com/zmmH1G58 new times(for 200,000 char string): real3m0.351s user3m1.299s sys 0m1.008s largest palindrome: amanaplanaracecaranalpanama On Oct 15, 1:22 pm, siddarth shankar wrote: > i could get it down to around 1.6/1.7 seconds > > s...@sid-:~$ time clojure dummy.clj > woohoo palindrome: eve > woohoo palindrome: ranynar > > real 0m1.739s > user 0m2.088s > sys 0m0.124s > > made a couple of changes > - only call 'palindrome?' for substrings between identical > characters(between 2 'p's etc.) > - ignore substrings smaller than our currently largest palindrome > > code: > --- > --- > - > (def source2 > "fourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnation > conceivedinzlibertyanddedicatedtothepropositionthatallmenarecreatedequalnow > weareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceiv > edandsodedicatedcanlongendureweareqmetonagreatbattlefiemldoftzhatwarwehavec > ometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavethe > irlivesthatthatnationmightliveitisaltogetherfangandproperthatweshoulddothis > butinalargersensewecannotdedicatewecannotconsecratewecannothallowthisground > thebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorpo > nwertoaddordetracttgheworldadswfilllittlenotlenorlongrememberwhatwesayhereb > utitcanneverforgetwhattheydidhereitisforusthelivingrathertobededicatedheret > otheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvanceditisrath > erforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonor > eddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasure > ofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthi > snationunsdergodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebyth > epeopleforthepeopleshallnotperishfromtheearth") > > (def max-length 2) > > (defn palindrome? > [#^String s] > (let [len (.length s)] > (loop [i 0 > j (dec len)] > (if (> i j) > (do > (println "woohoo palindrome: " s) > (when (> len max-length) ;; set the max-length > thread-safely? > (def max-length len))) > (when (= (.charAt s i) (.charAt s j)) > (recur (inc i) (dec j))) > > (defn find-largest-palindrome > [#^String s] > (let [len (.length s)] > (loop [i 0 > j (+ i max-length 1)] > (let [sub-string (.substring s i (inc j))] > (if (= (.charAt s i) (.charAt s j)) > (palindrome? sub-string)) ;; can spawn into a thread- > pool? > (if (= j (- len 1)) > (when (< i (- len max-length)) > (recur (inc i) (if (> len (+ i max-length 1)) > (+ i max-length 1) > (dec len > (recur i (inc j))) > > (find-largest-palindrome source2) > --- > --- > > - using clojure 1.1.0 (ubuntu maverick package!!) > - ignoring substrings smaller than current-palindrome makes a > difference of only about .5 secs (maybe better for larger strings?) > - can the recur bits in the code above be more elegant/idiomatic? > looks really hacky > > ps: getting clojure + emacs to work is still bumpy :D > > On Oct 14, 5:19 am, Btsai wrote: > > > > > I think the indexing in all-combs may be off, causing it to miss > > certain combinations/substrings. > > > user=> (all-combs "abc") > > ("a" "ab") > > > I used this instead: > > > (defn substrings [s] > > (let [length (count s)] > > (for [i (range length) > > j (range (inc i) (inc length))] > > (subs s i j > > > user=> (substrings "abc") > > ("a" "ab" "abc" "b" "bc" "c") > > > On Oct 12, 1:02 pm, tonyl wrote: > > > > Hi, I just started to learn clojure in a more serious way and I am > > > doing the first level of the greplin challenge. > > > > I made it to work with a short palindrome like the example they give > > > me, but when it comes to work with the input file, it takes for ever > > > and I have to stop it. > > > > $ time clj level1.clj > > > ^C > > > real 11m35.477s > > > user 1m44.431
Re: Improving Contrib
On Oct 19, 7:55 pm, Sean Corfield wrote: > On Tue, Oct 19, 2010 at 4:01 PM, Mike Meyer > > wrote: > > On Tue, 19 Oct 2010 15:51:17 -0700 (PDT) > > Mibu wrote: > >> The greatest impediment for me is having to sign a contract to > >> participate in an open source project. I understand Rich Hickey and > >> most of you guys live in the litigious US and have to cover > >> yourselves, but I feel not right about this. > > I've never run into a project - US-based or not - that required > > this. At least not for reading the dev list or submitting patches. > > In my experience, it's pretty standard practice for any successful > open source project that expects to be used by large corporations. > > I don't understand why anyone objects to them...? I've never understood the friction on this one: - If Apache and Sun/Oracle (along with a pile of others) do X w.r.t. legalities, it seems prudent to follow suit as is practical. - Barring that, do we really want to take even the smallest of chances? - Barring that, is not completion of the CA a reasonable a priori proxy for the level of commitment of a contributor, where a base level of commitment is desirable? - Barring that, if the FSF's 20 lines (or whatever) is the threshold – surely the size of a small bugfix – have we ever not patched a bug because someone's small patch was rejected due to the lack of a CA? Reporting a bug requires nothing. - Barring that, assuming you're not a well-credentialed open source lawyer, are you really comfortable second-guessing legal decisions from afar? Sorry for the rant. I suggested in the channel sometime last month that a "Lodge your CA here" table should be set up at the Conj. Anyone know if that's a go or not? IMO, no one should leave on Saturday without being settled in this department. - Chas -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Let usage question
On 20 October 2010 14:19, Dave Ray wrote: > Hey, > > I'm parsing a file with a chain of filter and map operations. To make > it a little more readable (to me), I put the steps in a let like this: > > (defn parse-dictionary > [reader] > (let [lines(read-lines reader) >trimmed (map #(.trim %1) lines) >filtered (filter is-dictionary-entry? trimmed)] > (map parse-entry filtered))) > > Is this style of let considered good/bad stylistically? Are there > technical tradeoffs between this and a bunch of nested forms? > > Thanks! > > Dave > Not sure about the technical implications, but I can offer another alternative: (defn parse-dictionary [reader] (->> (read-lines reader) (map #(.trim %1)) (filter is-dictionary-entry?) (map parse-entry))) I think this reads about as well as the (let ...) version. It's easy enough to trace the 'flow' of execution through the various forms. Regards, Stuart -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Conj arrivals and Thursday night...
I should be at the hotel around 6pm. Code, coffee, drinks, conversation all sound equally fine to me. On Oct 18, 9:32 am, Andrew Gwozdziewycz wrote: > Hey Conj goers, > > I'm scheduled to arrive around 6:30, and after I check in am planning > to spend the rest of the night writing code. Anyone want to help > commandeer a random lobby to join in on the fun? > > Andrew > --http://www.apgwoz.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
Let usage question
Hey, I'm parsing a file with a chain of filter and map operations. To make it a little more readable (to me), I put the steps in a let like this: (defn parse-dictionary [reader] (let [lines(read-lines reader) trimmed (map #(.trim %1) lines) filtered (filter is-dictionary-entry? trimmed)] (map parse-entry filtered))) Is this style of let considered good/bad stylistically? Are there technical tradeoffs between this and a bunch of nested forms? Thanks! Dave -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: getting started with clojure
On Tue, Oct 19, 2010 at 5:55 PM, ishkabible wrote: > lastly i have been messing around with new languages just to try them > out. Fantastic fun! I wish you the best of luck. > in trying out coljure (only functional language i have tried yet) > but i can compile anything longer than one line. Are you using the 'repl'? That process can feel very different from some styles of Clojure development. > im using Coljure Box > but im very confused as to how i am supposed to write code that dose > more than one thing. basically how do i save files, compile them, then > run them? Clojure Box likely has a specific process that it advocates since it uses "... clojure-mode and Slime, plus all the power of Emacs under the hood." While this development process works for some (most?) it doesn't work so well for others. I've documented one way of developing using Ant[1] and a certain folder structure... which was OK for a while but I've since switched to leiningen[2]. In the end all you _really_ need is to find a process that fits how you're used to working. You can refer to the 'Getting Started' page on the Assembla Wiki[3]. Again, good luck and have fun! -Rich [1] http://www.lithinos.com/Compiling-Clojure-Applications-and-Libraries-Round-2.html [2] http://github.com/technomancy/leiningen [3] http://www.assembla.com/wiki/show/clojure/Getting_Started -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.java.*
On Tue, Oct 19, 2010 at 6:37 PM, Brent Millare wrote: > Just wondering what are the plans for clojure.java.* > > It used to be in http://richhickey.github.com/clojure/ > > but now that we are using http://clojure.github.com/clojure > clojure.java.* is no longer listed. Looks like a bunch of namespaces have disappeared from that page (again? didn't someone else comment on a similar issue recently - and it got fixed?). -- 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: clojure.java.*
> Just wondering what are the plans for clojure.java.* > > It used to be inhttp://richhickey.github.com/clojure/ > > but now that we are usinghttp://clojure.github.com/clojure > clojure.java.* is no longer listed. user=> (use 'clojure.java.io) nil Seems like it's there, just not documented. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: getting started with clojure
I have written a tutorial just for beginners, that will quickly get you started on clojure. This tutorial was written based on my own experience learning clojure. When learning a new language I am impatient, and like to dive into thick of things immediately. Hopefully this will do the same for others also. http://fasttrackclojure.blogspot.com On Wed, Oct 20, 2010 at 5:25 AM, ishkabible wrote: > lastly i have been messing around with new languages just to try them > out. in trying out coljure (only functional language i have tried yet) > but i can compile anything longer than one line. im using Coljure Box > but im very confused as to how i am supposed to write code that dose > more than one thing. basically how do i save files, compile them, then > run 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 -- http://hi.im/santosh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: getting started with clojure
I use Leiningen to compile and run my Clojure projects. I create a new project with Leiningen, use Clojure Box to edit code and try out one line at a time, then switch back to Leiningen for downloading libraries or for compiling my own project into a library or program. http://github.com/technomancy/leiningen Or if you are just working with one file, it may be simpler to put a bunch of your code into a file and use the "load" command from the prompt in Clojure Box. On Tue, Oct 19, 2010 at 7:55 PM, ishkabible wrote: > lastly i have been messing around with new languages just to try them > out. in trying out coljure (only functional language i have tried yet) > but i can compile anything longer than one line. im using Coljure Box > but im very confused as to how i am supposed to write code that dose > more than one thing. basically how do i save files, compile them, then > run 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 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: SQLAlchemy in Clojure?
On 19 October 2010 02:18, Sean Devlin wrote: > Okay, I just finished a Python app for work. Using SQLAlchemy was a > joy. Has anyone ported this yet? > I've never used SQLAlchemy. How does it compare with e.g. Django's ORM? Regards, Stuart -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.java.*
Just wondering what are the plans for clojure.java.* It used to be in http://richhickey.github.com/clojure/ but now that we are using http://clojure.github.com/clojure clojure.java.* is no longer listed. -Brent -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
On Tue, 19 Oct 2010 16:26:24 -0700 (PDT) Rich Hickey wrote: > > > On Oct 19, 7:01 pm, Mike Meyer 620...@mired.org> wrote: > > On Tue, 19 Oct 2010 15:51:17 -0700 (PDT) > > > > Mibu wrote: > > > The greatest impediment for me is having to sign a contract to > > > participate in an open source project. I understand Rich Hickey and > > > most of you guys live in the litigious US and have to cover > > > yourselves, but I feel not right about this. > > > > I've never run into a project - US-based or not - that required > > this. > > http://www.apache.org/licenses/ > http://openjdk.java.net/contribute/ > http://forge.mysql.com/wiki/Contributing_Code > https://fedoraproject.org/wiki/Legal:Revised_Fedora_CLA_Draft#FPCA_Text > http://contributing.openoffice.org/programming.html > http://www.gnu.org/licenses/gpl-faq.html#AssignCopyright > http://framework.zend.com/wiki/display/ZFPROP/Contributor+License+Agreement > http://www.djangoproject.com/foundation/cla/faq/ > http://nodejs.org/cla.html > http://www.10gen.com/contributor The ones I've checked or am familiar with apparently define "contribute" differently than the clojure project does, in that they allow you to both subscribe to the developer list(s) and submit bug reports - including patches - without having to sign and post a contributor agreement. Or maybe it's the clojure web site making things difficult to find. Nuts, I happened to apply for my Chickasaw Nation citizenship today - which gives me tribal voting rights, free health care at tribal hospitals and clinics, the ability to get grants for education, housing, free laptops, etc, etc, etc. That was less work than being allowed to submit a bug to the issue tracking system for clojure (unless I just didn't find the right page). It was also more work than submitting patches looks to be for apache, django, gnu, fedora, or openoffice (from your list, though it sounds like openoffice may changed for the worse) or I know to be for FreeBSD, PostreSQL, OpenSolaris, Python, Cheetah, to name some I've been using for a while. Sure, many of them require you to create an account to submit any bug report. But that's straightforward, and a not unreasonable anti-spam measure. Some even require you to click a checkbox assigning the rights to anything you submit to the project in question as part of that process. But I can still contribute patches to these projects without having to print, sign and post any kind of developer agreement. 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
getting started with clojure
lastly i have been messing around with new languages just to try them out. in trying out coljure (only functional language i have tried yet) but i can compile anything longer than one line. im using Coljure Box but im very confused as to how i am supposed to write code that dose more than one thing. basically how do i save files, compile them, then run 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: Improving Contrib
On Oct 19, 7:38 pm, Phil Hagelberg wrote: > On Tue, Oct 19, 2010 at 4:26 PM, Rich Hickey wrote: > >http://contributing.openoffice.org/programming.html > > This is probably not a good example; the copyright assignment policy > for OpenOffice has caused the active contributors to fork it into > LibreOffice, which does not have such a policy: > > http://www.linux.com/news/enterprise/biz-enterprise/366193:libreoffic... > That may be your take on it, but they worked under the Sun SCA for quite a while. By all reports this fork seems more to be about stewardship under Oracle and the rate of change. Now they are locked into a license (the alternative to having CAs). They don't really have an option, as they don't hold the original CAs. Taking CAs now for new code wouldn't give them any more license flexibility, so it makes sense that they don't bother. Note here (http://keionline.org/ec-mysql) where Stallman himself argues for the importance of license flexibility: "There are fundamental and unavoidable legal obstacles to combining code from programs licensed under the different GPL versions." "the lack of a more flexible license* for MySQL will present considerable barriers to a new forked development path for MySQL" I'd rather have CAs than be locked into a license. As the primary author of the project, that's my choice, and these examples simply show it's not an unusual or non-mainstream one. Clojure's CA is a lose-nothing affair. It is not a copyright transfer, contributors retain all the rights in their work. And it makes the will-remain-open promise (which Sun was forced to add the their SCA early on, due to community pressure). It is in fact that clause which is preventing Oracle from taking the JDK (et al) closed moving forward. Yes, having a CA is a hurdle. Almost 200 people have managed to get over it. Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
On Tue, Oct 19, 2010 at 4:01 PM, Mike Meyer wrote: > On Tue, 19 Oct 2010 15:51:17 -0700 (PDT) > Mibu wrote: >> The greatest impediment for me is having to sign a contract to >> participate in an open source project. I understand Rich Hickey and >> most of you guys live in the litigious US and have to cover >> yourselves, but I feel not right about this. > I've never run into a project - US-based or not - that required > this. At least not for reading the dev list or submitting patches. In my experience, it's pretty standard practice for any successful open source project that expects to be used by large corporations. I don't understand why anyone objects to them...? -- 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: Improving Contrib
On Tue, Oct 19, 2010 at 4:26 PM, Rich Hickey wrote: > http://contributing.openoffice.org/programming.html This is probably not a good example; the copyright assignment policy for OpenOffice has caused the active contributors to fork it into LibreOffice, which does not have such a policy: http://www.linux.com/news/enterprise/biz-enterprise/366193:libreoffice-and-document-foundation-announced -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
Re: Improving Contrib
On Oct 19, 7:01 pm, Mike Meyer wrote: > On Tue, 19 Oct 2010 15:51:17 -0700 (PDT) > > Mibu wrote: > > The greatest impediment for me is having to sign a contract to > > participate in an open source project. I understand Rich Hickey and > > most of you guys live in the litigious US and have to cover > > yourselves, but I feel not right about this. > > I've never run into a project - US-based or not - that required > this. http://www.apache.org/licenses/ "The ASF desires that all contributors of ideas, code, or documentation to the Apache projects complete, sign, and submit (via postal mail, fax or email) an Individual Contributor License Agreement (CLA) [PDF form]." http://openjdk.java.net/contribute/ "Like many other open-source communities, the OpenJDK Community requires contributors to jointly assign their copyright on contributed code. If you haven't yet signed the Sun Contributor Agreement (SCA) then please do so, scan it and e-mail the result to sun_ca(at)sun.com." http://forge.mysql.com/wiki/Contributing_Code "If you expect to make code-related contributions, you must sign and return the Oracle Contributor Agreement (OCA). Without an OCA on file, Oracle cannot integrate your contribution into the MySQL code base or engage in extended discussions on proposed patches." https://fedoraproject.org/wiki/Legal:Revised_Fedora_CLA_Draft#FPCA_Text http://contributing.openoffice.org/programming.html http://www.gnu.org/licenses/gpl-faq.html#AssignCopyright http://framework.zend.com/wiki/display/ZFPROP/Contributor+License+Agreement http://www.djangoproject.com/foundation/cla/faq/ http://nodejs.org/cla.html http://www.10gen.com/contributor etc. Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
On Tue, 19 Oct 2010 15:51:17 -0700 (PDT) Mibu wrote: > The greatest impediment for me is having to sign a contract to > participate in an open source project. I understand Rich Hickey and > most of you guys live in the litigious US and have to cover > yourselves, but I feel not right about this. I've never run into a project - US-based or not - that required this. At least not for reading the dev list or submitting patches. If you don't trust the submitters to not sue you later, why do you trust them to not check in back doors or time bombs? 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: Improving Contrib
The greatest impediment for me is having to sign a contract to participate in an open source project. I understand Rich Hickey and most of you guys live in the litigious US and have to cover yourselves, but I feel not right about this. On Oct 19, 4:00 pm, Rich Hickey wrote: > We are taking several steps to improve contrib and the facilities used > to host Clojure development. The goal is to make it easier and more > desirable to work on the Clojure project, and encourage more libraries > to be developed within the project. > > There are several impediments to people working in or on contrib, and > within the Clojure project. The community is obviously vibrant, as > there are many independent libraries. But fewer people work on Clojure > itself or on libraries intended for inclusion in Clojure. I'd like > that to change. > > Although there have been recent efforts to make contrib more modular > from the Maven perspective (thanks Stuart Sierra!), it is still a > monolithic repo. Logically, the individual libs are more independent > than the repo structure would indicate. It should be much easier to > obtain, build, version, distribute, branch, test and modify individual > libraries. > > Some of these problems flow from historical choices made by the > project. In particular, without money, boxes and the staff to maintain > machines on the net, I chose free project hosting service providers - > first SourceForge, then Google Code, and most recently GitHub and > Assembla. In all cases, there was a tension between project and user > management and code granularity. It would have been difficult to > manage the contrib libs as independent projects/repos. > > Several things have changed recently that enable a better strategy. > GitHub has added an organization feature that lets us manage users at > the organization level and put multiple repos under the organization. > Contegix is donating a hosted box so we can run our own server (thanks > Contegix!), and the Clojure/core team now exists and is (voluntarily, > and among other things) providing much needed administrative support > (thanks Clojure/core team!). > > The New Model > > Contrib libraries will be independent repos under the Clojure GitHub > organization. All contributions to these libraries will be > contributions under the CA (therefor, no pulls). The primary authors > will have substantial independence in terms of versioning. branches > and releases etc, and it will be easy to obtain and work on a contrib > library a la carte. > > We will be moving from Assembla to a self-hosted installation of the > Atlassian suite, which they generously make available for free to open > source projects (thanks Atlassian!). It will give us a superior wiki > and bug tracking system. We will initially have support for Jira, > Confluence and FishEye, and will be able to centrally manage users > with Crowd. > > Individual contrib projects will get documentation and planning space > in the Confluence wiki, and a dedicated subproject in the Jira > tracking system. > > Contrib is not a Standard Lib > > People often ask if contrib constitutes a standard library. It has > always been a goal of contrib to support exploratory work of the > community that might or might not become part of Clojure proper, so > the simple answer is no. As volunteer open source efforts, each > library is likely to differ in quality, maturity and attention level. > In that respect, they don't differ from all of the other libraries on > GitHub. And with the new model, you will be using the same criteria in > evaluating a contrib library as you do any other open source library - > documentation, participation, recommendations, activity, stability, > bug reports etc. And you'll only consume as much of contrib as you > desire. Libraries will succeed on their merits. It is our plan to > reserve the 1.0.0+ designations for the more mature and widely > accepted libraries when they reach that point. That's as much > sanctioning as I anticipate for the near term. > > You've Got to be In it to Win it > > Why work within the Clojure project? Because you want your work to > eventually become part of Clojure and the Clojure distribution. You > want to tap into the core development effort and have an impact on it. > You are interested in collaborating on how best to make a set of > things work together in a coherent way, as Clojure does. > > Isn't the GitHub free-for-all easier? Yes, but with this new setup, > only very slightly so. The easiest thing is not necessarily the best > thing. Participating in a project involves cooperation and compromise, > and stewardship implies responsibility. > > Moving Forward > > We will be working on getting the existing contrib libraries moved > over to the new model. Meanwhile, I'm happy to announce three new and > exciting contrib libraries that are kicking off the new model: > > Chris Houser's Finger Tree -http://github.com/clojure/data.finger-tree > Chas Emerick's Network
Re: Multiple Files
On Tue, Oct 19, 2010 at 5:22 PM, Alan wrote: > defrecord defines a java class, not a clojure entity. instead of :use, > you need :import. > > (ns stuff.core > (:import (stuff phone-data))) It's an even better practice to go ahead and create a factory fn for your defrecord. Then consumers of your library don't need to import classes, they can just use/require your library. 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
Re: Multiple Files
defrecord defines a java class, not a clojure entity. instead of :use, you need :import. (ns stuff.core (:import (stuff phone-data))) On Oct 19, 1:02 pm, WoodHacker wrote: > Hi all, > > Can anyone help me with this? I have a program with multiple > files. The program uses various data references, which may be > accessed from different files. To facilitate this I usually put ref > variables in a separate file and then :use that file in all the > various modules that make up the program. That has worked perfectly > - except for on problem. I cannot seem to get defrecord to work in > the same way. If I put a defrecord description in my refs file I get > the following error: > > Exception in thread "main" java.lang.IllegalArgumentException: Unable > to resolve classname: phone-data > > The question is: Why doesn't this work? And how do I get around > it? Do I put the defrecord in each file it's to be used in? > > Bill -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Multiple Files
Hi all, Can anyone help me with this? I have a program with multiple files. The program uses various data references, which may be accessed from different files. To facilitate this I usually put ref variables in a separate file and then :use that file in all the various modules that make up the program. That has worked perfectly - except for on problem.I cannot seem to get defrecord to work in the same way. If I put a defrecord description in my refs file I get the following error: Exception in thread "main" java.lang.IllegalArgumentException: Unable to resolve classname: phone-data The question is: Why doesn't this work? And how do I get around it?Do I put the defrecord in each file it's to be used in? Bill -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
True, but if ivy.xml's aren't published, you can't use any of ivy's features. It's just maven without the 20 jars. Luke On Oct 19, 12:26 pm, Wilson MacGyver wrote: > I think what Rich meant is that, they will be available in a mvn repo. > > you can pull from mvn repo using ivy, etc. I use gradle to pull both > the current clojure and clojure-contrib all the time. > > > > > > > > > > On Tue, Oct 19, 2010 at 12:22 PM, Luke Renn wrote: > > Please consider Ivy. It's what Gradle uses and does dependency > > management better than Maven does. > > >http://ant.apache.org/ivy/ > >http://ant.apache.org/ivy/features.html > > > Thanks, > > > Luke > > > On Oct 19, 12:12 pm, Rich Hickey wrote: > >> On Oct 19, 12:04 pm, Wilson MacGyver wrote: > > >> > How should we as users consume the libs under the new umbrella? Is it > >> > fair > >> > to assume that most of these would be also uploaded by the creator into > >> > clojars as new versions become available, thus using build tools like > >> > mvn, gradle, lein, > >> > etc to "pull them in" as we need them? > > >> > since I assume we are moving away from a monolithic zip file? > > >> I don't know that it will be clojars, but yes, via the maven > >> infrastructure in general. > > >> Rich > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from 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: Improving Contrib
I think what Rich meant is that, they will be available in a mvn repo. you can pull from mvn repo using ivy, etc. I use gradle to pull both the current clojure and clojure-contrib all the time. On Tue, Oct 19, 2010 at 12:22 PM, Luke Renn wrote: > Please consider Ivy. It's what Gradle uses and does dependency > management better than Maven does. > > http://ant.apache.org/ivy/ > http://ant.apache.org/ivy/features.html > > Thanks, > > Luke > > On Oct 19, 12:12 pm, Rich Hickey wrote: >> On Oct 19, 12:04 pm, Wilson MacGyver wrote: >> >> > How should we as users consume the libs under the new umbrella? Is it fair >> > to assume that most of these would be also uploaded by the creator into >> > clojars as new versions become available, thus using build tools like >> > mvn, gradle, lein, >> > etc to "pull them in" as we need them? >> >> > since I assume we are moving away from a monolithic zip file? >> >> I don't know that it will be clojars, but yes, via the maven >> infrastructure in general. >> >> Rich > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from 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: Improving Contrib
Please consider Ivy. It's what Gradle uses and does dependency management better than Maven does. http://ant.apache.org/ivy/ http://ant.apache.org/ivy/features.html Thanks, Luke On Oct 19, 12:12 pm, Rich Hickey wrote: > On Oct 19, 12:04 pm, Wilson MacGyver wrote: > > > How should we as users consume the libs under the new umbrella? Is it fair > > to assume that most of these would be also uploaded by the creator into > > clojars as new versions become available, thus using build tools like > > mvn, gradle, lein, > > etc to "pull them in" as we need them? > > > since I assume we are moving away from a monolithic zip file? > > I don't know that it will be clojars, but yes, via the maven > infrastructure in general. > > Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
On Oct 19, 12:04 pm, Wilson MacGyver wrote: > How should we as users consume the libs under the new umbrella? Is it fair > to assume that most of these would be also uploaded by the creator into > clojars as new versions become available, thus using build tools like > mvn, gradle, lein, > etc to "pull them in" as we need them? > > since I assume we are moving away from a monolithic zip file? > I don't know that it will be clojars, but yes, via the maven infrastructure in general. Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
How should we as users consume the libs under the new umbrella? Is it fair to assume that most of these would be also uploaded by the creator into clojars as new versions become available, thus using build tools like mvn, gradle, lein, etc to "pull them in" as we need them? since I assume we are moving away from a monolithic zip file? -- 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: Conj arrivals and Thursday night...
On Oct 18, 2010, at 11:32 AM, Andrew Gwozdziewycz wrote: > Hey Conj goers, > > I'm scheduled to arrive around 6:30, and after I check in am planning > to spend the rest of the night writing code. Anyone want to help > commandeer a random lobby to join in on the fun? I'll be at the hotel around the same time, would be happy to join. - Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog, www.twitter.com/marick -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Improving Contrib
Many thanks to Rich and everyone at Relevance and elsewhere that are making this possible. FYI, I'll be migrating the existing nREPL codebase from it's current home (http://github.com/cemerick/nREPL) to the clojure organization umbrella today or tomorrow. It's been a hectic week or two. :-) - Chas On Oct 19, 10:00 am, Rich Hickey wrote: > We are taking several steps to improve contrib and the facilities used > to host Clojure development. The goal is to make it easier and more > desirable to work on the Clojure project, and encourage more libraries > to be developed within the project. > > There are several impediments to people working in or on contrib, and > within the Clojure project. The community is obviously vibrant, as > there are many independent libraries. But fewer people work on Clojure > itself or on libraries intended for inclusion in Clojure. I'd like > that to change. > > Although there have been recent efforts to make contrib more modular > from the Maven perspective (thanks Stuart Sierra!), it is still a > monolithic repo. Logically, the individual libs are more independent > than the repo structure would indicate. It should be much easier to > obtain, build, version, distribute, branch, test and modify individual > libraries. > > Some of these problems flow from historical choices made by the > project. In particular, without money, boxes and the staff to maintain > machines on the net, I chose free project hosting service providers - > first SourceForge, then Google Code, and most recently GitHub and > Assembla. In all cases, there was a tension between project and user > management and code granularity. It would have been difficult to > manage the contrib libs as independent projects/repos. > > Several things have changed recently that enable a better strategy. > GitHub has added an organization feature that lets us manage users at > the organization level and put multiple repos under the organization. > Contegix is donating a hosted box so we can run our own server (thanks > Contegix!), and the Clojure/core team now exists and is (voluntarily, > and among other things) providing much needed administrative support > (thanks Clojure/core team!). > > The New Model > > Contrib libraries will be independent repos under the Clojure GitHub > organization. All contributions to these libraries will be > contributions under the CA (therefor, no pulls). The primary authors > will have substantial independence in terms of versioning. branches > and releases etc, and it will be easy to obtain and work on a contrib > library a la carte. > > We will be moving from Assembla to a self-hosted installation of the > Atlassian suite, which they generously make available for free to open > source projects (thanks Atlassian!). It will give us a superior wiki > and bug tracking system. We will initially have support for Jira, > Confluence and FishEye, and will be able to centrally manage users > with Crowd. > > Individual contrib projects will get documentation and planning space > in the Confluence wiki, and a dedicated subproject in the Jira > tracking system. > > Contrib is not a Standard Lib > > People often ask if contrib constitutes a standard library. It has > always been a goal of contrib to support exploratory work of the > community that might or might not become part of Clojure proper, so > the simple answer is no. As volunteer open source efforts, each > library is likely to differ in quality, maturity and attention level. > In that respect, they don't differ from all of the other libraries on > GitHub. And with the new model, you will be using the same criteria in > evaluating a contrib library as you do any other open source library - > documentation, participation, recommendations, activity, stability, > bug reports etc. And you'll only consume as much of contrib as you > desire. Libraries will succeed on their merits. It is our plan to > reserve the 1.0.0+ designations for the more mature and widely > accepted libraries when they reach that point. That's as much > sanctioning as I anticipate for the near term. > > You've Got to be In it to Win it > > Why work within the Clojure project? Because you want your work to > eventually become part of Clojure and the Clojure distribution. You > want to tap into the core development effort and have an impact on it. > You are interested in collaborating on how best to make a set of > things work together in a coherent way, as Clojure does. > > Isn't the GitHub free-for-all easier? Yes, but with this new setup, > only very slightly so. The easiest thing is not necessarily the best > thing. Participating in a project involves cooperation and compromise, > and stewardship implies responsibility. > > Moving Forward > > We will be working on getting the existing contrib libraries moved > over to the new model. Meanwhile, I'm happy to announce three new and > exciting contrib libraries that are kicking off the new model: > > Chris Houser's Finger Tree -h
Re: Conj arrivals and Thursday night...
I get in after a 9 hour train ride around 4:40 + time from train station. Would certainly be up for some non amtrak food once I arrive. On Mon, Oct 18, 2010 at 12:32 PM, Andrew Gwozdziewycz wrote: > Hey Conj goers, > > I'm scheduled to arrive around 6:30, and after I check in am planning > to spend the rest of the night writing code. Anyone want to help > commandeer a random lobby to join in on the fun? > > Andrew > -- > http://www.apgwoz.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 > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Improving Contrib
We are taking several steps to improve contrib and the facilities used to host Clojure development. The goal is to make it easier and more desirable to work on the Clojure project, and encourage more libraries to be developed within the project. There are several impediments to people working in or on contrib, and within the Clojure project. The community is obviously vibrant, as there are many independent libraries. But fewer people work on Clojure itself or on libraries intended for inclusion in Clojure. I'd like that to change. Although there have been recent efforts to make contrib more modular from the Maven perspective (thanks Stuart Sierra!), it is still a monolithic repo. Logically, the individual libs are more independent than the repo structure would indicate. It should be much easier to obtain, build, version, distribute, branch, test and modify individual libraries. Some of these problems flow from historical choices made by the project. In particular, without money, boxes and the staff to maintain machines on the net, I chose free project hosting service providers - first SourceForge, then Google Code, and most recently GitHub and Assembla. In all cases, there was a tension between project and user management and code granularity. It would have been difficult to manage the contrib libs as independent projects/repos. Several things have changed recently that enable a better strategy. GitHub has added an organization feature that lets us manage users at the organization level and put multiple repos under the organization. Contegix is donating a hosted box so we can run our own server (thanks Contegix!), and the Clojure/core team now exists and is (voluntarily, and among other things) providing much needed administrative support (thanks Clojure/core team!). The New Model Contrib libraries will be independent repos under the Clojure GitHub organization. All contributions to these libraries will be contributions under the CA (therefor, no pulls). The primary authors will have substantial independence in terms of versioning. branches and releases etc, and it will be easy to obtain and work on a contrib library a la carte. We will be moving from Assembla to a self-hosted installation of the Atlassian suite, which they generously make available for free to open source projects (thanks Atlassian!). It will give us a superior wiki and bug tracking system. We will initially have support for Jira, Confluence and FishEye, and will be able to centrally manage users with Crowd. Individual contrib projects will get documentation and planning space in the Confluence wiki, and a dedicated subproject in the Jira tracking system. Contrib is not a Standard Lib People often ask if contrib constitutes a standard library. It has always been a goal of contrib to support exploratory work of the community that might or might not become part of Clojure proper, so the simple answer is no. As volunteer open source efforts, each library is likely to differ in quality, maturity and attention level. In that respect, they don't differ from all of the other libraries on GitHub. And with the new model, you will be using the same criteria in evaluating a contrib library as you do any other open source library - documentation, participation, recommendations, activity, stability, bug reports etc. And you'll only consume as much of contrib as you desire. Libraries will succeed on their merits. It is our plan to reserve the 1.0.0+ designations for the more mature and widely accepted libraries when they reach that point. That's as much sanctioning as I anticipate for the near term. You've Got to be In it to Win it Why work within the Clojure project? Because you want your work to eventually become part of Clojure and the Clojure distribution. You want to tap into the core development effort and have an impact on it. You are interested in collaborating on how best to make a set of things work together in a coherent way, as Clojure does. Isn't the GitHub free-for-all easier? Yes, but with this new setup, only very slightly so. The easiest thing is not necessarily the best thing. Participating in a project involves cooperation and compromise, and stewardship implies responsibility. Moving Forward We will be working on getting the existing contrib libraries moved over to the new model. Meanwhile, I'm happy to announce three new and exciting contrib libraries that are kicking off the new model: Chris Houser's Finger Tree - http://github.com/clojure/data.finger-tree Chas Emerick's Network REPL - http://github.com/clojure/tools.nrepl Michael Fogus's Unification Library - http://github.com/clojure/core.unify These are terrific contributions, and good examples of things that will have the greatest impact by being part of the Clojure project. Thanks guys! There are still some infrastructure things being worked out as regards Confluence, Jira etc, and the Conj is keeping everyone busy at the moment, but I expect this all to be
Re: Nested For(s)
Hi, On 19 Okt., 13:16, Laurent PETIT wrote: > user=> (def c ["a" "b" "c" "d" "e" "f"]) > #'user/c > user=> (map vector c (cycle (range x))) > (["a" 0] ["b" 1] ["c" 2] ["d" 3] ["e" 4] ["f" 0]) And to promote some 1.2 goodness: map-indexed. user=> (map-indexed #(vector %2 (rem %1 5)) "abcdefghijklmn") ([\a 0] [\b 1] [\c 2] [\d 3] [\e 4] [\f 0] [\g 1] [\h 2] [\i 3] [\j 4] [\k 0] [\l 1] [\m 2] [\n 3]) 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: Nested For(s)
2010/10/19 Ulises > Alternatively you can do: > > user> (def x 5) > user> (def y 7) > user> (take (* x y) (cycle (range x))) > (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) > user> > And don't forget that seqs produced by range, cycle, etc., are lazy (elements produced "on demand" - modulo chunked seqs optimizations-), so (cycle (range 5)) may be sufficient in your case, e.g. if you use it to "index" a fixed size collection (used in conjunction with 'map, the fixed size collection's size will limit things : user=> (def x 5) #'user/x user=> (def c ["a" "b" "c" "d" "e" "f"]) #'user/c user=> (map vector c (cycle (range x))) (["a" 0] ["b" 1] ["c" 2] ["d" 3] ["e" 4] ["f" 0]) user=> HTH, -- Laurent -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Nested For(s)
simply don't put a for inside a for: (for [x (range 5) y (range 5)] y) Hope this helps. JM On 19 oct, 06:57, Rising_Phorce wrote: > Nested For(s) produce lists of lists: > > =>(for [x (range 5)] > (for [y (range 5)] > y)) > > ((0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4)) > > I want to use for(s) in order to use the loop counters from the > bindings, but can I produce a list of values (flattened) without > having to flatten the resultant list? > > (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) > > 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: Nested For(s)
Alternatively you can do: user> (def x 5) user> (def y 7) user> (take (* x y) (cycle (range x))) (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) user> U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Nested For(s)
On Tue 19/10/10 06:57 , Rising_Phorce josh.fe...@gmail.com sent: > Nested For(s) produce lists of lists: > > =>(for [x (range 5)] > (for [y (range 5)] > y)) > > ((0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4)) > > I want to use for(s) in order to use the loop counters from the > bindings, but can I produce a list of values (flattened) without > having to flatten the resultant list? > > (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) > > Thanks. Hi, A single for expression can iterate over multiple sequences. Eg: user=> (for [x (range 3) y (range 5)] y) (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) Check (doc for) for more details. -- Dave -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Nested For(s)
Nested For(s) produce lists of lists: =>(for [x (range 5)] (for [y (range 5)] y)) ((0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4)) I want to use for(s) in order to use the loop counters from the bindings, but can I produce a list of values (flattened) without having to flatten the resultant list? (0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4) 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: Keyword names and namespaces
On Oct 19, 8:18 am, Rob Lachlan wrote: > I see, thank you for linking to the ticket, Phil that really clarifies > things. I suppose that I would tend more to Chas Emerick's view in > his sept 28 comment (on the ticket), questioning whether there is a > need to validate Keywords (and possibly symbols) stringently. But > I'll take your point that we shouldn't count on the current behaviour > continuing. FWIW, in Common Lisp no validation is done on symbol names; they can be arbitrary strings. Strictly speaking, the reader doesn't validate them, either, but in order to parse them it has to place some restrictions, e.g. to disallow ambiguous strings like foo::bar:baz. However, the CL reader allows one to quote characters in symbol names, so you can effectively intern any string with it: for example, foo::| abCDef gh:123::@&"| is a valid symbol in the FOO package. Personally I don't see any value in restricting what can be interned; symbols are not necessarily only used as keyword or variable names. However, consistency between how a symbol is printed and how it is read back in is important. In Clojure, also, Java interop could be a problem in principle if Clojure symbols are to be used as class, method or field names; however, in such cases the problem can be solved locally, by disallowing certain symbols when compiling to a Java class, or by mangling them. Cheers, Alessio -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en