Re: Clojure Sticker
Thanks On Jul 29, 2012 3:38 AM, Benjamin Kircher benjamin.kirc...@gmail.com wrote: On Sat, Jul 28, 2012 at 2:05 PM, Rich Hickey richhic...@gmail.com wrote: You can now get official Clojure stickers here: http://clojure.org/swag I'll be adding T-shirts etc soon. Rich On Jul 19, 2012, at 3:13 PM, charlie wrote: Yeah any sort of vector image should work for us On Wed, Jul 18, 2012 at 7:59 PM, Alex Kurilin a...@kurilin.net wrote: +1. A temporary workaround would be getting a .svg that you could turn into stickers yourself, if that's ok with Rich. We did something similar with the vim logo on Reddit. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en Awesome. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Why is EMPTY.withMeta(meta()) used instead of just EMPTY in clojure.lang.*?
Thanks, but the question was not about the empty() methods. On Sunday, July 29, 2012 4:14:09 AM UTC+2, tbc++ wrote: On Sat, Jul 28, 2012 at 7:47 AM, Per Mildner wrote: Looking at the persistent types in clojure.lang.* (PersistentVector.java et al.) I see several occurrences of the idiom EMPTY.withMeta(meta()) where EMPTY is a constant (static final) denoting an empty collection of the appropriate type. What I can not understand, given that these types are all persistent, is why the EMPTY constant is, in effect, copied at most places where it is used. Why not use the same EMPTY instance instead, i.e. replace EMPTY.withMeta(meta()) with just EMPTY. Unless I miss something this could not hurt and would save some time and space. In this context, the empty() method does not mean get an empty of this type, instead it means empty this collection. So if we want to return a new collection that looks the same, except it is empty, then we need to pull in the metadata from the old collection. Example: = (meta (empty (with-meta [1 2 3] {:foo true}))) {:foo true} Timothy -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why is EMPTY.withMeta(meta()) used instead of just EMPTY in clojure.lang.*?
I am sorry, You are correct. I see what you mean. I mis-interpreted meta() as returning an empty meta-map. On Sunday, July 29, 2012 10:26:46 AM UTC+2, Per Mildner wrote: Thanks, but the question was not about the empty() methods. On Sunday, July 29, 2012 4:14:09 AM UTC+2, tbc++ wrote: On Sat, Jul 28, 2012 at 7:47 AM, Per Mildner wrote: Looking at the persistent types in clojure.lang.* (PersistentVector.java et al.) I see several occurrences of the idiom EMPTY.withMeta(meta()) where EMPTY is a constant (static final) denoting an empty collection of the appropriate type. What I can not understand, given that these types are all persistent, is why the EMPTY constant is, in effect, copied at most places where it is used. Why not use the same EMPTY instance instead, i.e. replace EMPTY.withMeta(meta()) with just EMPTY. Unless I miss something this could not hurt and would save some time and space. In this context, the empty() method does not mean get an empty of this type, instead it means empty this collection. So if we want to return a new collection that looks the same, except it is empty, then we need to pull in the metadata from the old collection. Example: = (meta (empty (with-meta [1 2 3] {:foo true}))) {:foo true} Timothy -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
help with lein-localrepo
I want to use goose(https://github.com/jiminoc/goose) in a Clojure project and found a StackOverflow answer that pointed me to lein-localrepo. However, I couldn't figure out how to use it. I did: lein localrepo install ../goose/target/goose-2.1.19.jar goose/goose 2.1.19 And lein locallrepo list does show goose, but I don't know how to use it inside the repository. `lein deps` gives me nothing, and I'm not sure how to require goose into the REPL or my core.clj. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[no subject]
I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart Halloway's by-pairs function to turn the sequence into pairs of numbers and check for a pair that is 2,2. This code in has22 below works if pasted into the REPL and evaluated but as a function it always returns false. If anyone can explain my error to me it'd be great. ( defn by-pairs [coll] (let [take-pair (fn [c] (when (next c) (take 2 c)))] (when-let [pair (seq (take-pair coll))] (lazy-seq (cons pair (by-pairs (rest coll))) (defn has22 [a] (if (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [a]))) true false)) user (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [1 2 2 2 ]))) true user (has22 [1 2 2 2]) false John Holland -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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:
In your has22 definition, (by-pairs [a]) should be (by-pairs a) On Sun, Jul 29, 2012 at 9:07 AM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart Halloway's by-pairs function to turn the sequence into pairs of numbers and check for a pair that is 2,2. This code in has22 below works if pasted into the REPL and evaluated but as a function it always returns false. If anyone can explain my error to me it'd be great. ( defn by-pairs [coll] (let [take-pair (fn [c] (when (next c) (take 2 c)))] (when-let [pair (seq (take-pair coll))] (lazy-seq (cons pair (by-pairs (rest coll))) (defn has22 [a] (if (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [a]))) true false)) user (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [1 2 2 2 ]))) true user (has22 [1 2 2 2]) false John Holland -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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:
Also, take a look at `partition'. On Sun, Jul 29, 2012 at 3:19 PM, Mark Rathwell mark.rathw...@gmail.com wrote: In your has22 definition, (by-pairs [a]) should be (by-pairs a) On Sun, Jul 29, 2012 at 9:07 AM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart Halloway's by-pairs function to turn the sequence into pairs of numbers and check for a pair that is 2,2. This code in has22 below works if pasted into the REPL and evaluated but as a function it always returns false. If anyone can explain my error to me it'd be great. ( defn by-pairs [coll] (let [take-pair (fn [c] (when (next c) (take 2 c)))] (when-let [pair (seq (take-pair coll))] (lazy-seq (cons pair (by-pairs (rest coll))) (defn has22 [a] (if (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [a]))) true false)) user (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [1 2 2 2 ]))) true user (has22 [1 2 2 2]) false John Holland -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re:
Thanks! On Sun, Jul 29, 2012 at 9:22 AM, Moritz Ulrich ulrich.mor...@gmail.comwrote: Also, take a look at `partition'. On Sun, Jul 29, 2012 at 3:19 PM, Mark Rathwell mark.rathw...@gmail.com wrote: In your has22 definition, (by-pairs [a]) should be (by-pairs a) On Sun, Jul 29, 2012 at 9:07 AM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart Halloway's by-pairs function to turn the sequence into pairs of numbers and check for a pair that is 2,2. This code in has22 below works if pasted into the REPL and evaluated but as a function it always returns false. If anyone can explain my error to me it'd be great. ( defn by-pairs [coll] (let [take-pair (fn [c] (when (next c) (take 2 c)))] (when-let [pair (seq (take-pair coll))] (lazy-seq (cons pair (by-pairs (rest coll))) (defn has22 [a] (if (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [a]))) true false)) user (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [1 2 2 2 ]))) true user (has22 [1 2 2 2]) false John Holland -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- __ Note new email address jbholl...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Sticker
On 07/28/2012 07:05 AM, Rich Hickey wrote: You can now get official Clojure stickers here: http://clojure.org/swag I've already ordered enough for myself and all my coworkers. I'll paste one on my laptop lid (as will they all), and -- let's see -- one for the car, one for the front window at home, Thank you for this bit of administrivia. Tom. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: community interest in machine learning (?)
Hey Ben, It's the same problem. user (incanter/exp (incanter/minus 3254604.9658621363)) 0.0 But it's not the functions. It's the math. Euler's number 2.71828... raised to the power of 3254604.9658621363, gives Infinity. So for my neural net's activation func, either i) I shouldn't used a sigmoid, or ii) my linear combiner needs to keep values within a certain bound. My neuron inputs are below. And it's the bid and sk volumes and the long time value that's giving me such a large number. - 1.3239 (bid price) - 1.32379 (ask price) - 300.0 (bid volume) - 225.0 (ask volume) - 1335902400676 ( #DateTime 2012-05-01T20:00:00.676Z long value) I just had the idea to try a Gaussian or tanh activation function. I think this is the point where I'll give clojure-encoghttps://github.com/jimpil/clojure-encoga whirl. I have a feeling I'll be running into a lot of these data and other algorithmic problems. And it'd be good to work with something that has already dealt with these issues. I still don't know if I need to normalize my input data, how to untangle the activation result for back propagation, etc. Any insights are welcome. Tim Washington Interruptsoftware.ca 416.843.9060 On Sat, Jul 28, 2012 at 7:44 PM, Ben Mabey b...@benmabey.com wrote: On 7/28/12 4:52 PM, Timothy Washington wrote: Hey Jim, Encog does look very interesting. Right now, I'm trying (and failing) to implement the sigmoid function. I'm using wikipedia's referencehttp://en.wikipedia.org/wiki/Sigmoid_function, and trying to use Incanter's (incanter/exp) function, but Incanter's function doesn't seem to work: user user (incanter/exp -3254604.9658621363) 0.0 user user (incanter/exp 3254604.9658621363) Infinity Try this... (use 'incanter.core) = (defn sigmoid [z] (div 1 (plus 1 (exp (minus z) = (sigmoid 0) 0.5 = (sigmoid 7) 0.9990889488055994 = (sigmoid 112) 1.0 = (sigmoid -112) 2.285693676718672E-49 If you want the library to be fast you will want to be using primitives or use the underlying colt API.. for learning purposes you don't really need to worry about that though. HTH, 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: community interest in machine learning (?)
Hi Tim, According to : http://www.heatonresearch.com/content/encog-30-article-2-design-goals-overview encog 3 should have descent support for any temporal (time-series) based prediction support in particular for financial predictions...I'm afraid however that the only example that I've ported to clojure-encog which uses temporal data is the sunspot example (SVM not NN). Also, you shouldn't have any problems with the data (most likely you need to normalize them - I usually find (-1 1) or (0 1) to work best. for an example of how exactly you would do it look for PREDICT-SUNSPOT-SVM here: https://github.com/jimpil/clojure-encog/blob/master/src/clojure_encog/examples.clj these 2 lines do all the job with regards to your input data: normalizedSunspots (prepare :array-range nil nil :raw-seq spots :ceiling 0.9 :floor 0.1) train-set ((make-data :temporal-window normalizedSunspots) window-size 1) As far as algorimthmic problems go encog has been around for quite a while...even though I don't necessarily agree with all the design decisions made along the way I find it is a rather mature lib...of course it is written in Java so being large means it is a bit of a mess! also there is a lot of duplication in random places...anyways, what I'm trying to say is: if you've got a specific example in mind, (like the financial prediction) maybe it's worth trying it out using clojure-encog or the encog-workbench (the gui) or any other already-made lib and see how it goes...writing your own will certainly teach you loads but it might take a while until you actually test what you want to test... Normalisation, randomisation or both are almost always needed... Hope that helps... Jim On Sun, Jul 29, 2012 at 5:41 PM, Timothy Washington twash...@gmail.comwrote: Hey Ben, It's the same problem. user (incanter/exp (incanter/minus 3254604.9658621363)) 0.0 But it's not the functions. It's the math. Euler's number 2.71828... raised to the power of 3254604.9658621363, gives Infinity. So for my neural net's activation func, either i) I shouldn't used a sigmoid, or ii) my linear combiner needs to keep values within a certain bound. My neuron inputs are below. And it's the bid and sk volumes and the long time value that's giving me such a large number. - 1.3239 (bid price) - 1.32379 (ask price) - 300.0 (bid volume) - 225.0 (ask volume) - 1335902400676 ( #DateTime 2012-05-01T20:00:00.676Z long value) I just had the idea to try a Gaussian or tanh activation function. I think this is the point where I'll give clojure-encoghttps://github.com/jimpil/clojure-encoga whirl. I have a feeling I'll be running into a lot of these data and other algorithmic problems. And it'd be good to work with something that has already dealt with these issues. I still don't know if I need to normalize my input data, how to untangle the activation result for back propagation, etc. Any insights are welcome. Tim Washington Interruptsoftware.ca 416.843.9060 On Sat, Jul 28, 2012 at 7:44 PM, Ben Mabey b...@benmabey.com wrote: On 7/28/12 4:52 PM, Timothy Washington wrote: Hey Jim, Encog does look very interesting. Right now, I'm trying (and failing) to implement the sigmoid function. I'm using wikipedia's referencehttp://en.wikipedia.org/wiki/Sigmoid_function, and trying to use Incanter's (incanter/exp) function, but Incanter's function doesn't seem to work: user user (incanter/exp -3254604.9658621363) 0.0 user user (incanter/exp 3254604.9658621363) Infinity Try this... (use 'incanter.core) = (defn sigmoid [z] (div 1 (plus 1 (exp (minus z) = (sigmoid 0) 0.5 = (sigmoid 7) 0.9990889488055994 = (sigmoid 112) 1.0 = (sigmoid -112) 2.285693676718672E-49 If you want the library to be fast you will want to be using primitives or use the underlying colt API.. for learning purposes you don't really need to worry about that though. HTH, 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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
On Thursday, July 26, 2012 3:59:46 PM UTC-4, Aaron Lebo wrote: {snip} The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done. Curious: If you didn't find what you needed in Java's standard class library, where else did you go looking for Java libraries? {snip} I found myself digging around in github repos to actual read code instead of documentation a lot more than I ever did with Python. Obviously these are just issues of time, and they'll improve. One way that seems to me a good way to help projects get more docs is to create a fork and add and/or improve existing docstrings. Another way might be to fork, create a top-level doc dir, write and add a .md file or two, and send a pull-request. Another way might be to just add docs to the project's wiki, or write your own docs (or even a blog post) and add a link to them from the project's wiki. Clojure docs and the cheatsheet help a lot, though. Love these two resources. Note that there's some nice versions of the cheatsheet with tooltips at http://jafingerhut.github.com/ . I guess if there is anything I'd love to see is some kind of style guide. {snip} There were lots of times I found myself wondering whether the right way was to indent the if form after the conditional or first argument, {snip} Does such a thing like PEP 8 exist for Clojure? It seems to me that the 3 major style rules are: 1. line up args vertically, 2. use 2-space indents, and 3. let Emacs otherwise do indenting for you. Minor note: that 3rd rule can be difficult to follow if, say, you're not using Emacs. :) I'd love to see something which suggests how common tasks should be done, I feel like it might help newbies like me feel more at ease. This sounds like a job for a community-driven cookbook. There's a cookbook at http://en.wikibooks.org/wiki/Clojure_Programming , but I'd always figured that wikibooks was for books, rather than for use as a general wiki (please, correct me if I'm wrong here.). There also appears to be a cookbook at http://www.gettingclojure.com/cookbook:clojure-cookbook . It seems to me that a community-driven wiki would be a good place for a cookbook (and other misc things) to live. (Personally, I like [gitit](http://gitit.net/). Well, those are some of my notes on using Clojure. I feel a little embarrassed writing this up because I feel like someone will pick it to death, {snip} Great post. Thanks for writing this up! ---John -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 add an URL into the classpath?
Hello programmers, Hi, Sierra. Thank you replying. O.K. I can not always contol the classloader of the whole JVM. Then, how can I get the dynamic classloader for my current code/thread? Or can't I? Regards, Yoshinori Kohyama -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
doc strings for both interfaces and concrete implementations
Is there a way to create doc strings on both interfaces (procotols, multi functions) and concrete implementations (protocol implementation, multi-methods)? For now it seems to me I can only have doc strings for the interfaces. If that is the case, I feel it is something worth fixing, because in my view doc string is not a nice-to-have thing, but essential for dynamic languages. Assuming we don't have it yet, what I am hoping for is, when I do (doc symbol), or use slime-describe-symbol, it should list the doc strings for the interfaces along with the doc strings of all of its concrete implementations. For example, I may have a multi-function like this: (defmulti make-obj Create a new obj. (fn [ args] (first args))) This multi function dispatches on the first argument, and each method can have quite different argument list and of course doc strings. But for now I don't seem to have a way to document them. Another thing I hope for (but less important), is to be able to have different doc strings for different signatures of the same function. I think computer language is called language for a reason. It is not just for making computers to do magic things, but also be able to let people (youself in 4 months or another programmer) to under how that magic happens. It is a communication media like a natural language, and doc strings are even more important here because dynamic languages are so dynamic. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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:
Here's an edge case for you: (has22 [1 2 2 1]) ; false :) 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: doc strings for both interfaces and concrete implementations
Warren Lynn wrn.l...@gmail.com writes: Is there a way to create doc strings on both interfaces (procotols, multi functions) and concrete implementations (protocol implementation, multi-methods)? No, I don't think so. Assuming we don't have it yet, what I am hoping for is, when I do (doc symbol), or use slime-describe-symbol, it should list the doc strings for the interfaces along with the doc strings of all of its concrete implementations. You could use alter-meta! to add a hunk to the docstring of the interface at the place where you add a new implementation (to have impl and docs near each other). Not all interfacy thingies know their implementations, btw, so having separate docs for the impls wouldn't neccessarily allow what you request above. Another thing I hope for (but less important), is to be able to have different doc strings for different signatures of the same function. In general, all different versions of a function should somehow do the same thing, so with separate docstrings you'd need to repeat yourself. A good guideline is to write the big picture first, followed by the meaning of the different parameters. Bye, Tassilo -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
getting http 500 after registration =( On Thursday, July 26, 2012 10:59:46 PM UTC+3, Aaron Lebo wrote: Hello! Sometime around 2 and a half months ago, I started to work on a new project using Clojure. I've been using Python heavily for about 6 six years working for a small direct mail company and before that started programming with Ruby on Rails. This new project was something out of left field, so I had different options on what technology to use. I ended up choosing Clojure, and my work on the site has been my first real experience using a lisp, Clojure, and the JVM. I'd like to share my experiences and how that has differed with my previous Python work. Before that, I'd like to make a little plug for my site. It is called kodefund http://www.kodefund.com (www.kodefund.com). The basic idea is to take the familiar Kickstarter model but to really focus on applying that to open source development. I feel that previous crowdfunding efforts have shown that there is an interest by developers to fund projects that they are enthusiastic about. When this works, everyone wins: the developer working on the project can devote their full time and effort on the actual project and still make a living and others get the benefits of the open source software. I feel like it is preferable over selling licenses to proprietary software or other efforts. So, every project on kodefund is required to be open source. This differentiates it from other crowdfunding sites, and helps to apply a filter: you know what you are getting when you go there instead of seeing dozens of projects for unrelated stuff. One other difference is that you can also start a project which is more or less a reverse Kickstarter. This allows you to take an idea for a project or issue you want fixed, raise funding, and find someone who will actually implement the project. Other users get to submit applications and you choose from them to find the most capable candidate. Once you chose an application, that person takes over the project. Finally, one other push I want to make is to open up proprietary software. Maybe your company has written some software in-house, but there's no real incentive to release it. What if you could crowdfund the software, get paid to release it, and the open source community as a whole could benefit from that? I feel like crowdfunding and open source software are an ideal fit. I'm getting off track here. I'll shift to my actual experiences using Clojure. I was more than a little nervous about using the JVM. It always seemed like some huge, scary thing, and digging into Java libraries was not something I wanted to do. Something which resolved this was leiningen. I feel like it is absolutely brilliant, and it really makes adding libraries to your project a non-issue. Things have slowly changed in Python, but it used to be that downloading dependencies was a global process and you ended up with a site-packages that was full of dozens of old libraries that you used for other projects. Being able to specify in my project.clj file exactly which libraries I need and those getting downloaded automatically is a really nice feature that I will look for similar functionality in other languages from now on. I was also pleasantly surprised by the library availability. The vast majority of things that I needed such as oauth2 support and such already have decent Clojure wrappers. When I did drop down into Java, I found that to be painless. The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done. Considering the language itself, one of the first things I noticed (or didn't) was the parentheses. I don't remember when, but they simply are a non-issue after a short amount of time. One slight thing I did have a problem with was that inserting a parenthesis at the wrong place could completely alter the flow of code and it was not immediately obvious. This is not an issue when you are closing off a line or two of expressions, but when you are halfway down the page, insert a paren and everything breaks, it could get frustrating. This is probably resolved through better editor usage. I unfortunately could never get emacs with clojure-mode and goodies working properly on my Windows machine, so I ended up using the counterclockwise Eclipse plugin. It was not a horrible experience but things such as auto-indenting a large block of code was something I never figured out. Continuing on the surface, some of my favorite parts of the language are little syntax additions. I absolutely love the syntax for anonymous functions. Python obviously has limitations
Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
Hi Samrat. Could you explain how you are trying to access the site (address) and what is happening? I started out in noir, and ended up using a lot of the design patterns and validation library. I stopped using noir for two reasons: I like being able to see the routes of all of my urls on a single page (noir binds them to their function definition), and a lot of the tutorials out there concerning different libraries are based on raw Ring or Compojure. I didn't want to get stuck debugging some minor issue simply because I didn't understand the differences between using a library with noir/Compojure, which did happen once. I really enjoyed noir, though, particularly the validation, it is very clever, though as I said earlier I'd love it if it did conversion as well as validation. Using Compojure was a blast. It rarely got in the way, which, imo is what a routing framework should do. On the templating side I used Hiccup. That might be one of my favorite libraries in any language. I desire writing templates in Python because you are stuck opening and closing every brace. It is tedious and error-prone. Hiccup cuts down on that tremendously. div class=row div class=eight columns p id=testtest/p div id=yep class=four columns spanyep/span /div /div turns into: [:div.row [:div.eight.columns [:p#test test]] [:div#yep.four.columns [:span yep]]] You can't beat that. Notice particularly how easy it is to define ids and classes. Plus it is just Clojure, so you end being able to use the whole power of the language templating. On the db side I used korma. It beats the hell out of writing raw db statements, but it too stays out of the way. I really like the way that it just inserts joins as part of your result hash maps. (defentity profile) (defentity user (has-one profile)) (select user (where {:id (*user* :id)}) (with profile)) Something like that would automatically join profile to user and return a single hash map. It is a contrived example, but you get the gist. Only problem I had with it was that you end up writing by hand more complex stuff like unions. Not a big deal but you want the same convenience. On Sat, Jul 28, 2012 at 12:12 AM, Samrat Man Singh samratmansi...@gmail.com wrote: I can't access your site. Also, I wanted to ask whether you used Noir or used a lower-level option(Compojure,etc)? On Friday, July 27, 2012 1:44:46 AM UTC+5:45, Aaron Lebo wrote: Hello! Sometime around 2 and a half months ago, I started to work on a new project using Clojure. I've been using Python heavily for about 6 six years working for a small direct mail company and before that started programming with Ruby on Rails. This new project was something out of left field, so I had different options on what technology to use. I ended up choosing Clojure, and my work on the site has been my first real experience using a lisp, Clojure, and the JVM. I'd like to share my experiences and how that has differed with my previous Python work. Before that, I'd like to make a little plug for my site. It is called kodefund http://www.kodefund.com (www.kodefund.com). The basic idea is to take the familiar Kickstarter model but to really focus on applying that to open source development. I feel that previous crowdfunding efforts have shown that there is an interest by developers to fund projects that they are enthusiastic about. When this works, everyone wins: the developer working on the project can devote their full time and effort on the actual project and still make a living and others get the benefits of the open source software. I feel like it is preferable over selling licenses to proprietary software or other efforts. So, every project on kodefund is required to be open source. This differentiates it from other crowdfunding sites, and helps to apply a filter: you know what you are getting when you go there instead of seeing dozens of projects for unrelated stuff. One other difference is that you can also start a project which is more or less a reverse Kickstarter. This allows you to take an idea for a project or issue you want fixed, raise funding, and find someone who will actually implement the project. Other users get to submit applications and you choose from them to find the most capable candidate. Once you chose an application, that person takes over the project. Finally, one other push I want to make is to open up proprietary software. Maybe your company has written some software in-house, but there's no real incentive to release it. What if you could crowdfund the software, get paid to release it, and the open source community as a whole could benefit from that? I feel like crowdfunding and open source software are an ideal fit. I'm getting off track here. I'll shift to my actual experiences using Clojure. I was more than a little nervous about using the JVM. It always seemed like some huge, scary thing, and digging into Java libraries was
Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
Curious: If you didn't find what you needed in Java's standard class library, where else did you go looking for Java libraries? Usually it was just a matter of Googling something like java rss if I was in need of an rss library. Once I found a library which seemed useful and supported, in this case, ROME http://rometools.org/ I'd then look for the maven link on their site or googled rome maven. Usually you can find the link pretty fast, but the mvn repository http://mvnrepository.com/ also seems like a could place to check. Once you find the most recent version you just stick that in your project.clj file and let lein handle the rest. It isn't an exact process by any means but it worked well. One way that seems to me a good way to help projects get more docs is to create a fork and add and/or improve existing docstrings. ... Yeah, when I stated that I found myself digging around on github there's actually two sides to it. Yeah it was a bummer that there aren't docs on more libraries, but the flip side of the coin is that it is a testament to the language that I could actually do so and grok other people's code after only a few weeks of use. It seems to me that the 3 major style rules are: 1. line up args vertically, 2. use 2-space indents, and 3. let Emacs otherwise do indenting for you. Minor note: that 3rd rule can be difficult to follow if, say, you're not using Emacs. :) Thank you. One of my big disappointments with the project was that I couldn't use Emacs working. I've always been awed by some of the descriptions of emacs lisp editing environments and I wanted to experience that myself. Unfortunately there is some issue with Windows 7 and file permissions and I setting up the Emacs side that I could never resolve through googling. Perhaps it would be worth spending more time to fix, but I hadn't even used the language and I just wanted to use something that worked, which for its faults, Eclipse and counterclockwise did. This sounds like a job for a community-driven cookbook. There's a cookbook at http://en.wikibooks.org/wiki/Clojure_Programming , but I'd always figured that wikibooks was for books, rather than for use as a general wiki (please, correct me if I'm wrong here.). There also appears to be a cookbook at http://www.gettingclojure.com/cookbook:clojure-cookbook . It seems to me that a community-driven wiki would be a good place for a cookbook (and other misc things) to live. (Personally, I like [gitit]( http://gitit.net/). Certainly sounds useful. Here's PEP 8 as an example of what I'm talking about: http://www.python.org/dev/peps/pep-0008/ Thanks for your comments. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
What would we do without bugs? :) :( I've noticed that several people have gotten in using regular registration as well as even logging in through github or Facebook. What method are you using? On Sun, Jul 29, 2012 at 2:15 PM, Andrew Kondratovich andrew.kondratov...@gmail.com wrote: getting http 500 after registration =( On Thursday, July 26, 2012 10:59:46 PM UTC+3, Aaron Lebo wrote: Hello! Sometime around 2 and a half months ago, I started to work on a new project using Clojure. I've been using Python heavily for about 6 six years working for a small direct mail company and before that started programming with Ruby on Rails. This new project was something out of left field, so I had different options on what technology to use. I ended up choosing Clojure, and my work on the site has been my first real experience using a lisp, Clojure, and the JVM. I'd like to share my experiences and how that has differed with my previous Python work. Before that, I'd like to make a little plug for my site. It is called kodefund http://www.kodefund.com (www.kodefund.com). The basic idea is to take the familiar Kickstarter model but to really focus on applying that to open source development. I feel that previous crowdfunding efforts have shown that there is an interest by developers to fund projects that they are enthusiastic about. When this works, everyone wins: the developer working on the project can devote their full time and effort on the actual project and still make a living and others get the benefits of the open source software. I feel like it is preferable over selling licenses to proprietary software or other efforts. So, every project on kodefund is required to be open source. This differentiates it from other crowdfunding sites, and helps to apply a filter: you know what you are getting when you go there instead of seeing dozens of projects for unrelated stuff. One other difference is that you can also start a project which is more or less a reverse Kickstarter. This allows you to take an idea for a project or issue you want fixed, raise funding, and find someone who will actually implement the project. Other users get to submit applications and you choose from them to find the most capable candidate. Once you chose an application, that person takes over the project. Finally, one other push I want to make is to open up proprietary software. Maybe your company has written some software in-house, but there's no real incentive to release it. What if you could crowdfund the software, get paid to release it, and the open source community as a whole could benefit from that? I feel like crowdfunding and open source software are an ideal fit. I'm getting off track here. I'll shift to my actual experiences using Clojure. I was more than a little nervous about using the JVM. It always seemed like some huge, scary thing, and digging into Java libraries was not something I wanted to do. Something which resolved this was leiningen. I feel like it is absolutely brilliant, and it really makes adding libraries to your project a non-issue. Things have slowly changed in Python, but it used to be that downloading dependencies was a global process and you ended up with a site-packages that was full of dozens of old libraries that you used for other projects. Being able to specify in my project.clj file exactly which libraries I need and those getting downloaded automatically is a really nice feature that I will look for similar functionality in other languages from now on. I was also pleasantly surprised by the library availability. The vast majority of things that I needed such as oauth2 support and such already have decent Clojure wrappers. When I did drop down into Java, I found that to be painless. The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done. Considering the language itself, one of the first things I noticed (or didn't) was the parentheses. I don't remember when, but they simply are a non-issue after a short amount of time. One slight thing I did have a problem with was that inserting a parenthesis at the wrong place could completely alter the flow of code and it was not immediately obvious. This is not an issue when you are closing off a line or two of expressions, but when you are halfway down the page, insert a paren and everything breaks, it could get frustrating. This is probably resolved through better editor usage. I unfortunately could never get emacs with clojure-mode and goodies working properly on my Windows machine, so I ended up using the counterclockwise Eclipse plugin. It was not a horrible experience but things such as auto-indenting a large block of code
Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
Just saw that you are actually in the system here: http://www.kodefund.com/users/8/ The 500 error probably was in sending off the validation email, which you dont need to login. Sorry, some of these little things pop up from time to time. On Sun, Jul 29, 2012 at 2:47 PM, Aaron Lebo aaron.m.l...@gmail.com wrote: What would we do without bugs? :) :( I've noticed that several people have gotten in using regular registration as well as even logging in through github or Facebook. What method are you using? On Sun, Jul 29, 2012 at 2:15 PM, Andrew Kondratovich andrew.kondratov...@gmail.com wrote: getting http 500 after registration =( On Thursday, July 26, 2012 10:59:46 PM UTC+3, Aaron Lebo wrote: Hello! Sometime around 2 and a half months ago, I started to work on a new project using Clojure. I've been using Python heavily for about 6 six years working for a small direct mail company and before that started programming with Ruby on Rails. This new project was something out of left field, so I had different options on what technology to use. I ended up choosing Clojure, and my work on the site has been my first real experience using a lisp, Clojure, and the JVM. I'd like to share my experiences and how that has differed with my previous Python work. Before that, I'd like to make a little plug for my site. It is called kodefund http://www.kodefund.com (www.kodefund.com). The basic idea is to take the familiar Kickstarter model but to really focus on applying that to open source development. I feel that previous crowdfunding efforts have shown that there is an interest by developers to fund projects that they are enthusiastic about. When this works, everyone wins: the developer working on the project can devote their full time and effort on the actual project and still make a living and others get the benefits of the open source software. I feel like it is preferable over selling licenses to proprietary software or other efforts. So, every project on kodefund is required to be open source. This differentiates it from other crowdfunding sites, and helps to apply a filter: you know what you are getting when you go there instead of seeing dozens of projects for unrelated stuff. One other difference is that you can also start a project which is more or less a reverse Kickstarter. This allows you to take an idea for a project or issue you want fixed, raise funding, and find someone who will actually implement the project. Other users get to submit applications and you choose from them to find the most capable candidate. Once you chose an application, that person takes over the project. Finally, one other push I want to make is to open up proprietary software. Maybe your company has written some software in-house, but there's no real incentive to release it. What if you could crowdfund the software, get paid to release it, and the open source community as a whole could benefit from that? I feel like crowdfunding and open source software are an ideal fit. I'm getting off track here. I'll shift to my actual experiences using Clojure. I was more than a little nervous about using the JVM. It always seemed like some huge, scary thing, and digging into Java libraries was not something I wanted to do. Something which resolved this was leiningen. I feel like it is absolutely brilliant, and it really makes adding libraries to your project a non-issue. Things have slowly changed in Python, but it used to be that downloading dependencies was a global process and you ended up with a site-packages that was full of dozens of old libraries that you used for other projects. Being able to specify in my project.clj file exactly which libraries I need and those getting downloaded automatically is a really nice feature that I will look for similar functionality in other languages from now on. I was also pleasantly surprised by the library availability. The vast majority of things that I needed such as oauth2 support and such already have decent Clojure wrappers. When I did drop down into Java, I found that to be painless. The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done. Considering the language itself, one of the first things I noticed (or didn't) was the parentheses. I don't remember when, but they simply are a non-issue after a short amount of time. One slight thing I did have a problem with was that inserting a parenthesis at the wrong place could completely alter the flow of code and it was not immediately obvious. This is not an issue when you are closing off a line or two of expressions, but when you are halfway down the page, insert a paren and everything breaks, it could get
Re: doc strings for both interfaces and concrete implementations
In general, all different versions of a function should somehow do the same thing, so with separate docstrings you'd need to repeat yourself. A good guideline is to write the big picture first, followed by the meaning of the different parameters. I agree the design should keep all implementations to do the same thing *conceptually*, as that is what an interface is for. However, I can imagine it is very common that a concrete implementation needs extra documentation for certain implementation specific things. That does not mean the implementation violates the interface, it is just that there are more details that are outside the scope of the interface. An interface spec cannot capture everything, otherwise it is already a concrete implementation instead of an interface. A simple example will be nth. If nth were defined as an interface, then its spec would be Return the nth element of an ordered collection. But for its implementation of a sequence, the doc can say this takes linear time, or maybe will throw an exception on infinite sequence. But for its implementation of a vector, it may say this takes constant time. In summary, in my view, this is a very legitimate and basic need. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: help with lein-localrepo
On Sunday, 29 July 2012 17:37:40 UTC+5:30, Samrat Man Singh wrote: I want to use goose(https://github.com/jiminoc/goose) in a Clojure project and found a StackOverflow answer that pointed me to lein-localrepo. However, I couldn't figure out how to use it. I did: lein localrepo install ../goose/target/goose-2.1.19.jar goose/goose 2.1.19 And lein locallrepo list does show goose, but I don't know how to use it inside the repository. `lein deps` gives me nothing, and I'm not sure how to require goose into the REPL or my core.clj. You should create a project (lein new foo) and include goose as a dependency in project.clj before you can use it. Make sure you are using the correct version of lein-localrepo based on the Leiningen version. Shantanu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: how can a become *agent* in this code?
I'll ask this differently. I do not see a used anywhere inside of that function. So why is it being given to that function? On Tuesday, July 24, 2012 1:36:27 AM UTC-4, Philip Potter wrote: a is the current value of the agent. *agent* is the agent itself. Remember the universal update mechanism: an agent, atom or ref is updated by applying a (normally) pure function to it; the function takes the current state and returns the new state. Phil On Jul 24, 2012 5:16 AM, larry google groups lawrencecloj...@gmail.com wrote: I am confused by this blog post: http://www.bestinclass.dk/index.clj/2009/09/php-vs-clojure-what-does-it-cost-to-be-old-school.html In particular, I am confuse by this function: (defn log-dumper [a] (Thread/sleep *write-delay*) (let [sql-statements (let [tmp @*sql-buffer*] (ref-set *sql-buffer* []) tmp)] (doseq [stmt sql-statements] (run *mysql-connection* stmt)) (send-off *agent* log-dumper))) It looks like a is being passed in as an argument to the function. But at the end of the function, *agent* is being passed into the function again. I don't see a point in this function where a is magically transformed into *agent*. I'm under the impression that this same agent is suppose to be sent, over and over again, every 5 minutes, for all eternity, into the function. But if the function is suppose to send the same agent to itself, 5 minutes in the future, then I would think that if the argument is named a then a is what would be send-off to the function again. The blog post says: send-off myself (the *agent* is the thread) to the same function again, ie. keep running. How does this work? How does the final line know that *agent* is the a that was passed in as an argument? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: how can a become *agent* in this code?
On 30 July 2012 01:34, larry google groups lawrencecloj...@gmail.com wrote: I'll ask this differently. I do not see a used anywhere inside of that function. So why is it being given to that function? I have not used send-off, but I think the answer is as follows: When you call (send-off the-agent the-function), the-function gets called with a single argument (which is the current value of the agent). That is why log-dumper has an argument. Of course, log-dumper does not use its argument, but it must still be there. Perhaps it should have been called dummy. *agent* is the current agent. You said that at the end *agent* is being passed to log-dumper. This is wrong. The send-off call causes log-dumper to be called with the contents/value of the agent. Not with *agent*. On Tuesday, July 24, 2012 1:36:27 AM UTC-4, Philip Potter wrote: a is the current value of the agent. *agent* is the agent itself. Remember the universal update mechanism: an agent, atom or ref is updated by applying a (normally) pure function to it; the function takes the current state and returns the new state. Phil On Jul 24, 2012 5:16 AM, larry google groups lawrencecloj...@gmail.com wrote: I am confused by this blog post: http://www.bestinclass.dk/index.clj/2009/09/php-vs-clojure-what-does-it-cost-to-be-old-school.html In particular, I am confuse by this function: (defn log-dumper [a] (Thread/sleep *write-delay*) (let [sql-statements (let [tmp @*sql-buffer*] (ref-set *sql-buffer* []) tmp)] (doseq [stmt sql-statements] (run *mysql-connection* stmt)) (send-off *agent* log-dumper))) It looks like a is being passed in as an argument to the function. But at the end of the function, *agent* is being passed into the function again. I don't see a point in this function where a is magically transformed into *agent*. I'm under the impression that this same agent is suppose to be sent, over and over again, every 5 minutes, for all eternity, into the function. But if the function is suppose to send the same agent to itself, 5 minutes in the future, then I would think that if the argument is named a then a is what would be send-off to the function again. The blog post says: send-off myself (the *agent* is the thread) to the same function again, ie. keep running. How does this work? How does the final line know that *agent* is the a that was passed in as an argument? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 -- Michael Wood esiot...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: how can a become *agent* in this code?
When you call (send-off the-agent the-function), the-function gets called with a single argument (which is the current value of the agent). That is why log-dumper has an argument. Of course, log-dumper does not use its argument, but it must still be there. Perhaps it should have been called dummy. I think the most common Clojure convention for dummy names it to use a single underscore _. Various linting tools support this convention and e.g. won't warn about an unused function parameter if it is called _. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 add an URL into the classpath?
You can't. The dynamic classloader is an internal implementation detail of Clojure; you can't rely on it being available anywhere. If you're interested in runtime control over the the Java classpath, look at https://github.com/cemerick/pomegranate -S On Sunday, July 29, 2012 2:05:00 PM UTC-4, Yoshinori Kohyama wrote: Hello programmers, Hi, Sierra. Thank you replying. O.K. I can not always contol the classloader of the whole JVM. Then, how can I get the dynamic classloader for my current code/thread? Or can't I? Regards, Yoshinori Kohyama -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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:
Hi John, 'partition' will be useful for you, as Moritz pointed out. (partition 2 1 [1 2 3 4]) - ((1 2) (2 3) (3 4)) (partition 2 1 [1 2 2 4]) - ((1 2) (2 2) (2 4)) (partition 2 1 [1 2 2 2]) - ((1 2) (2 2) (2 2)) (some #(= % [2 2]) (partition 2 1 [1 2 3 4])) - nil (some #(= % [2 2]) (partition 2 1 [1 2 2 4])) - true (some #(= % [2 2]) (partition 2 1 [1 2 2 2])) - true (filter #(= % [2 2]) (partition 2 1 [1 2 3 4])) - () (filter #(= % [2 2]) (partition 2 1 [1 2 2 4])) - ((2 2)) (filter #(= % [2 2]) (partition 2 1 [1 2 2 2])) - ((2 2) (2 2)) I'm sorry I can't recognize whether you need a pair of 2s or two pairs of 2s. If you need one or more pairs of 2s, do (defn has22 [coll] (boolean (some #(= % [2 2]) (partition 2 1 coll (has22 [1 2 3 4]) - false (has22 [1 2 2 4]) - true (has22 [1 2 2 2]) - true If you need two or more pairs of 2s, do (defn has222 [coll] ( 1 (count (filter #(= % [2 2]) (partition 2 1 coll) (has222 [1 2 3 4]) - false (has222 [1 2 2 4]) - false (has222 [1 2 2 2]) - true Regards, Yoshinori Kohyama -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 add an URL into the classpath?
Hi Sierra, Thank you for your kind and quick answers to my questions. I see. I'll read the page you referred. Regards, Yoshinori Kohyama -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en