Re: clojure starter package for aichallenge ?
I failed to mention that both the files are in a directory named mybot I could be wrong but I think they have to be in the root of the zip file, i.e. no directories. I just zip up ants.clj and MyBot.clj into a file and it works. HTH, 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
Pattern matching for map content
Hi! Pattern matching is fine for sequence or vector destruction. Is is possible to destruct map and make pattern machting? For example I would like to make constraint for to some query service. It would be done as map for example: { :name Tom :surname Jakarta :birthDate (Date.) } or { :personalId 12312312132 } Then I would like to dispatch this Value Object: (defn service ([ {:keys [name surname]} ] (println searching by personal data)) ([{:keys [personalId]} ] (println searching by id))) Why using map instead of specific type of VO? Because I don't want to decleare types of VO which doesn't bring any value to domain problem. Maybe matchure or other lib already implements it? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: where do you put clojure.java.jdbc?????
jayvandal: If you don't use Leiningen, make sure that the pathname for clojure.java.jdbc jar file exists in classpath. On Oct 25, 1:39 pm, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 24, 2011 at 8:36 PM, jayvandal s...@ida.net wrote: I am running Vista. I installed Clojure as c:\clojure. You don't need to install Clojure if you're using Leiningen (and I'd recommend you use Leiningen for managing project dependencies). Where and how do you put the file [org.clojure/java.jdbc 0.0.3-SNAPSHOT]] In project.clj (see Leiningen above) - and 0.1.0 is the current version of c.j.jdbc. -- Sean A Corfield -- (904) 302-SEAN An Architect's View --http://corfield.org/ World Singles, LLC. --http://worldsingles.com/ Railo Technologies, Inc. --http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Confusing interplay between macros and metadata
Alan Malloy a...@malloys.org writes: It seems to me that it would be nice to have macros automatically include, on their result forms, the metadata from their input form. Of course, macros may wish to add metadata as well, so the two maps should probably be merged. However, there are certainly some problems with this approach: for example if a macro wants to return something that can't suppport metadata (like an Integer), the compiler needs to be careful not to try to include it. So I'm hoping the community can comment on whether this feature would be useful, or whether there are fundamental problems with it that I haven't foreseen. Is there a reason this can't make it into a future version of Clojure? I think this is an excellent idea. Overall I believe this reduces the number of situations in which one needs to be actively aware that a particular expression will be subject to macro-expansion. The alternative-world where the 99% of well-behaved macros returning IMetas manually forward metadata from form seems like a world with way too much boilerplate to me. Forwarding metadata does preclude macros which use metadata applied to form as parameters and construct new metadata which may not include the literal values specified in the user-supplied metadata. I'm not sure this is a good idea anyway, but this sort of case -- and any others where metadata should not be forwarded/merged -- could easily be supported by providing a variation of defmacro with the current behavior. Or perhaps by configuring the metadata-forwarding behavior via metadata on the macro var -- something like: (defmacro foo {:forward-meta false} ...) ;; or, (defmacro ^:replace-meta foo ...) If a macro expands to something which doesn't implement IMeta, then I believe the compiler needs to error out if metadata is applied to it, just as it does applying metadata to non-IMeta literals. To do otherwise would be inconsistent, and result in the same silent data-loss as macros are yielding today. This proposal doesn't touch forwarding metadata on forms which become macro arguments, obviously. There's still room for inconsistency there, but I think that's clearly in the court of individual macro authors to implement the correct behavior. Are there other contexts where metadata should potentially be forwarded? I don't know how often this comes up, but: (= (meta ^:foo (quote foo)) (meta (quote ^:foo foo))) ;; = false -Marshall -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Pattern matching for map content
On Tue, Oct 25, 2011 at 11:20, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! Pattern matching is fine for sequence or vector destruction. Is is possible to destruct map and make pattern machting? For example I would like to make constraint for to some query service. It would be done as map for example: { :name Tom :surname Jakarta :birthDate (Date.) } or { :personalId 12312312132 } Then I would like to dispatch this Value Object: (defn service ([ {:keys [name surname]} ] (println searching by personal data)) ([{:keys [personalId]} ] (println searching by id))) Why using map instead of specific type of VO? Because I don't want to decleare types of VO which doesn't bring any value to domain problem. Maybe matchure or other lib already implements it? Clojure provides only destructuring, not pattern matching. (It's my impression that Rich is not a fan of mixing destructuring with control flow implied by pattern matching.) If you want pattern matching, matchure seems like just what you need. For your particular example, take a look at matchure's defn-match. https://github.com/dcolthorp/matchure // 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: Is Clojure Simple?
Something is simple as long as your mental model is simple to track. Something which doesn't cause you headache. If you can't build mental model in your head, then its definitely not simple. Every time you think I have mental model which works like this, but before this I must remember about this and that, or assume that there is something to add which behave like this, it is proof that it is doesn't solve problems in a simplest way. All design patterns are proof of that used tools are not simple and must be made simple by applying as simple as possible additional mental model. For example OO programming have a lot of design patterns. When design pattern becomes mental model which solve specific problem and is not addition to the goal but language feature then you can be sure that language is simple to such solve domain problems. Now looking at Clojure which claims to be general purpose language, the Clojure is simple since it: - allows you to turn design patterns into language features (as whole lisp) - is near to mathematical logic (lambda, definition of functions - functions without side effect with which you can reason about) - is practical since it is also about data manipulation (not a first time I have turned XML into s-expressions - interpretation, function definition, control flow you have out of box) There are some also drawbacks about Clojure: - there is no simple made currying so its not as near as for example Haskell to lambda calculus - you can't reason about data types until runtime and empirically tests - it is bound to JVM infrastructure (ClojureScript and CLR version want to change that) There is a lot other fields in which Clojure doesn't fit, so its not simple in: - real time systems (JVM is not real time cause of GC) - hardware programming on low level (assemblers or C are much more suitable) There is a lot other things to say about being simple but for now it should answer you question. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Is Clojure Simple?
2011/10/25 Michael Jaaka michael.ja...@googlemail.com: Something is simple as long as your mental model is simple to track. Something which doesn't cause you headache. Disagree. The whole point of Rich's talk is to have people not conflate simple and easy, or it seems to me that this is what you're doing here. simple is objective. You start talking about your mental model is simple to track = you probably meant easy to track. And anyway, your, mental model seems more like subjective material than objective material. If you can't build mental model in your head, then its definitely not simple. Every time you think I have mental model which works like this, but before this I must remember about this and that, or assume that there is something to add which behave like this, it is proof that it is doesn't solve problems in a simplest way. All design patterns are proof of that used tools are not simple and must be made simple by applying as simple as possible additional mental model. For example OO programming have a lot of design patterns. When design pattern becomes mental model which solve specific problem and is not addition to the goal but language feature then you can be sure that language is simple to such solve domain problems. Now looking at Clojure which claims to be general purpose language, the Clojure is simple since it: - allows you to turn design patterns into language features (as whole lisp) - is near to mathematical logic (lambda, definition of functions - functions without side effect with which you can reason about) - is practical since it is also about data manipulation (not a first time I have turned XML into s-expressions - interpretation, function definition, control flow you have out of box) There are some also drawbacks about Clojure: - there is no simple made currying so its not as near as for example Haskell to lambda calculus - you can't reason about data types until runtime and empirically tests - it is bound to JVM infrastructure (ClojureScript and CLR version want to change that) There is a lot other fields in which Clojure doesn't fit, so its not simple in: - real time systems (JVM is not real time cause of GC) - hardware programming on low level (assemblers or C are much more suitable) There is a lot other things to say about being simple but for now it should answer you question. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Is there a String protocol?
I was wondering if there was a common protocol to get a string representation of an object yet. Also, are there common protocols for ints, doubles, chars, etc? Having just spent a lot of time writing Python, having an int function that worked on both Strings and Ints was great. I'd love to be able to use a protocol for this. Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: bit-or arity appears limited to 2 items
Thanks! That was it! Blake On Oct 23, 10:24 pm, Sean Corfield seancorfi...@gmail.com wrote: On Fri, Oct 21, 2011 at 4:12 PM, rugby_road cabjh...@embarqmail.com wrote: The bit-or arity seems to be limited to 2, rather than more, which seems to disagree with the documentation. I get Wrong number of args (3) passed to: core$bit-or for (bit-or 1 1 1). Have I misunderstood this operation; shouldn't it take any number of values? Clojure 1.3.0: user= (doc bit-or) - clojure.core/bit-or ([x y] [x y more]) Bitwise or nil user= (bit-or 1 1 1) 1 user= *clojure-version* {:major 1, :minor 3, :incremental 0, :qualifier nil} Clojure 1.2.1: user= (doc bit-or) - clojure.core/bit-or ([x y]) Bitwise or nil user= (bit-or 1 1 1) java.lang.IllegalArgumentException: Wrong number of args (3) passed to: core$bit-or (NO_SOURCE_FILE:2) user= *clojure-version* {:major 1, :minor 2, :incremental 1, :qualifier } So it looks like the ability to take more than two arguments was added in 1.3.0 (and the doc-string agrees). -- Sean A Corfield -- (904) 302-SEAN An Architect's View --http://corfield.org/ World Singles, LLC. --http://worldsingles.com/ Railo Technologies, Inc. --http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Pattern matching for map content
it's better to use https://github.com/clojure/core.match On Tue, Oct 25, 2011 at 11:32 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Oct 25, 2011 at 11:20, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! Pattern matching is fine for sequence or vector destruction. Is is possible to destruct map and make pattern machting? For example I would like to make constraint for to some query service. It would be done as map for example: { :name Tom :surname Jakarta :birthDate (Date.) } or { :personalId 12312312132 } Then I would like to dispatch this Value Object: (defn service ([ {:keys [name surname]} ] (println searching by personal data)) ([{:keys [personalId]} ] (println searching by id))) Why using map instead of specific type of VO? Because I don't want to decleare types of VO which doesn't bring any value to domain problem. Maybe matchure or other lib already implements it? Clojure provides only destructuring, not pattern matching. (It's my impression that Rich is not a fan of mixing destructuring with control flow implied by pattern matching.) If you want pattern matching, matchure seems like just what you need. For your particular example, take a look at matchure's defn-match. https://github.com/dcolthorp/matchure // 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 -- With best wishes, Alex Ott http://alexott.net/ Tiwtter: alexott_en (English), alexott (Russian) Skype: alex.ott -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Pattern matching for map content
On Tue, Oct 25, 2011 at 15:33, Alex Ott alex...@gmail.com wrote: it's better to use https://github.com/clojure/core.match Thanks, I'd forgotten about core.match. // ben On Tue, Oct 25, 2011 at 11:32 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Oct 25, 2011 at 11:20, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! Pattern matching is fine for sequence or vector destruction. Is is possible to destruct map and make pattern machting? For example I would like to make constraint for to some query service. It would be done as map for example: { :name Tom :surname Jakarta :birthDate (Date.) } or { :personalId 12312312132 } Then I would like to dispatch this Value Object: (defn service ([ {:keys [name surname]} ] (println searching by personal data)) ([{:keys [personalId]} ] (println searching by id))) Why using map instead of specific type of VO? Because I don't want to decleare types of VO which doesn't bring any value to domain problem. Maybe matchure or other lib already implements it? Clojure provides only destructuring, not pattern matching. (It's my impression that Rich is not a fan of mixing destructuring with control flow implied by pattern matching.) If you want pattern matching, matchure seems like just what you need. For your particular example, take a look at matchure's defn-match. https://github.com/dcolthorp/matchure // 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 -- With best wishes, Alex Ott http://alexott.net/ Tiwtter: alexott_en (English), alexott (Russian) Skype: alex.ott -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3 wonky behavior
Right Rich, Thanks. But that was a simplified reduction of real usage. Typically the declare is found in a nested structure: (describe something (context fooey (with bar 42) ; declare comes from this macro (it works (should= 42 @bar ; here bar be unbound I'll see if I can restructure Speclj to get all the Vars declared at the root level. But I'd still like to know…. Is this defined behavior? Or am I jumping through hoops to avoid behavior that doesn't belong? Micah On Oct 24, 2011, at 7:23 PM, Rich Hickey wrote: You should use 'do' for that kind of thing, not list. Rich On Oct 20, 2011, at 1:53 PM, Micah Martin wrote: I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q)) java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref Thanks to @cemerick for helping me condense the snippet, and thanks to both @cemerick and @chouser for the lively discussion on IRC. Yet the discussion was inconclusive. Is the above expected behavior? Micah -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Is Clojure Simple?
Interesting discussion of this talk, including comments from Rich (or at least someone claiming to be Rich): http://www.reddit.com/r/programming/comments/lirke/simple_made_easy_by_rich_hickey_video/ On Oct 25, 7:00 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2011/10/25 Michael Jaaka michael.ja...@googlemail.com: Something is simple as long as your mental model is simple to track. Something which doesn't cause you headache. Disagree. The whole point of Rich's talk is to have people not conflate simple and easy, or it seems to me that this is what you're doing here. simple is objective. You start talking about your mental model is simple to track = you probably meant easy to track. And anyway, your, mental model seems more like subjective material than objective material. If you can't build mental model in your head, then its definitely not simple. Every time you think I have mental model which works like this, but before this I must remember about this and that, or assume that there is something to add which behave like this, it is proof that it is doesn't solve problems in a simplest way. All design patterns are proof of that used tools are not simple and must be made simple by applying as simple as possible additional mental model. For example OO programming have a lot of design patterns. When design pattern becomes mental model which solve specific problem and is not addition to the goal but language feature then you can be sure that language is simple to such solve domain problems. Now looking at Clojure which claims to be general purpose language, the Clojure is simple since it: - allows you to turn design patterns into language features (as whole lisp) - is near to mathematical logic (lambda, definition of functions - functions without side effect with which you can reason about) - is practical since it is also about data manipulation (not a first time I have turned XML into s-expressions - interpretation, function definition, control flow you have out of box) There are some also drawbacks about Clojure: - there is no simple made currying so its not as near as for example Haskell to lambda calculus - you can't reason about data types until runtime and empirically tests - it is bound to JVM infrastructure (ClojureScript and CLR version want to change that) There is a lot other fields in which Clojure doesn't fit, so its not simple in: - real time systems (JVM is not real time cause of GC) - hardware programming on low level (assemblers or C are much more suitable) There is a lot other things to say about being simple but for now it should answer you question. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Losing your head with side effects
I need to read WAV files, and don't have time to recode the reader in Clojure. It's Java, and it's got side effects. I can read a number of frames from the WAV file with this code: (defn read-frames [wav-file num-frames] (let [num-samples (* num-frames (.getNumChannels wav-file)) buffer (double-array num-samples) frames-read (.readFrames wav-file buffer 0 num-frames)] (if (= frames-read num-frames) (vec buffer) nil))) So this is pretty straightforward...it uses this wav-file object, calls .readFrames() on it which reads into an array of doubles (passed in as buffer) and returns a vector of these values. Every time you call this function, it returns the next num-frames values as a vector, so it's operating by side effects. I want to make a seq of reading these frames. I thought I might use repeatedly, but it doesn't know to stop when the f returns nil. So I just coded it myself: (defn wavfile-chunk-seq [num-frames wav-file] (lazy-seq (let [x (read-frames wav-file num-frames)] (if (nil? x) '() (cons x (wavfile-chunk-seq num-frames wav-file)) Only problem is, it's holding onto its head somehow. When I (count (wavfile-chunk-seq n wav-file)) and check memory, it's all still there somehow. I'm 99% positive the WAV file object in Java isn't retaining the memory, because it uses a much smaller buffer. Can anybody see what I'm doing wrong? Maybe I should change my approach, and try to generate a Java Iterator over these values, and just use iterator-seq? Thanks in advance for any ideas... Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Pattern matching for map content
Thx, this is exactly what I 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: Losing your head with side effects
It appears I'm not understanding how something works in the REPL (or maybe deeper). For instance: (def big (range 1000)) ; memory is small now (count big) = 1000 ; memory is huge now (System/gc) ; memory is still huge now (def big nil) (System/gc) ; memory is small again So somehow when count realizes big, I'm guessing it gets memoized and stuck in some sort of cache attached to the var big. If I: (do (System/gc) (count (range 1000)) (System/gc)) ; memory is small before and after I think the version I wrote originally is fine; I just wasn't testing it properly. Sorry to bother folks! Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: R.I.P. John McCarthy
For those in fresh need of having their minds blown, this is always a good detonator: http://www.paulgraham.com/rootsoflisp.html Sam --- http://sam.aaron.name On 25 Oct 2011, at 04:58, finbeu wrote: John McCarthy, the father of Lisp, died last night at the age of 84. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Code problem: setting an atom from a deref'd atom that's inside a let.
This code probably will not make a whole lotta sense since I reduced it down to show only the problem at hand, but I'm hoping someone can explain why this doesn't work the way I expected it would: = (def data (atom {:k1 v1 :k2 v2 :k3 v3})) #'user/data = (def flag (atom nil)) #'user/flag = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) = (oops!) (:k1) nil = @flag {} I had expected this flag would now hold the value from x1, but instead it's empty. Now if the only change I make is not to deref the x1 atom when resetting: = (def flag (atom nil)) #'user/flag = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag x1)] (println v1))) = (oops!) (:k1) nil = @flag #Atom@7dad453f: {:k1 other} The atom value is available. So why didn't the first version with deref work? Please Thanks, Tim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Losing your head with side effects
Range is lazy. First you define a range, which is just a promise that the variable will be rendering a seq with 10M when asked for the elements. When you count the sequence you realize it and it takes up much space. When you let go if it it's of course GCed. The problem is that you hold on to the head (first element) of the sequence. If you do (count (range 1000)) clojure will go through it lazily and throw away elements as they are counted, hence much less memory usage. Let go of the head! :) /Linus 2011/10/25 Mike cki...@gmail.com It appears I'm not understanding how something works in the REPL (or maybe deeper). For instance: (def big (range 1000)) ; memory is small now (count big) = 1000 ; memory is huge now (System/gc) ; memory is still huge now (def big nil) (System/gc) ; memory is small again So somehow when count realizes big, I'm guessing it gets memoized and stuck in some sort of cache attached to the var big. If I: (do (System/gc) (count (range 1000)) (System/gc)) ; memory is small before and after I think the version I wrote originally is fine; I just wasn't testing it properly. Sorry to bother folks! Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
All, We talked about the possibility of getting some ideas about extracurricular activities during the Conj days (and possibly training days). I've created a spreadsheet at the link below to collect ideas. It is not my intention to be the organizer of these activities. Instead, if you have an idea then please be prepared to own it. The matter of space for these activities would need to be worked out by Conj planners or activity organizers, but having a list would help that process. https://docs.google.com/spreadsheet/ccc?key=0Alim_jfrt24MdDFqZVZsNW0tamtQR2pPTHJZTkN6Y0Ehl=en_US I've entered an example, feel free to add your own ideas. :-) This should be epic. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
Tim Robinson tim.blacks...@gmail.com writes: = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) So why didn't the first version with deref work? Because `filter' produces a lazy list, which isn't realized (and the side effects generated) until your call to `println'. Furthermore, the documentation for `filter' explicitly notes that pred must be free of side-effects. Looking at the implementation, I'm not sure why function-argument purity matters more for `filter' than any other sequence-generating higher-order function. Does anyone else know the reason? -Marshall -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
Please note that nothing is too humble! If you have a cool piece of code or technique that you'd like to show off for 10 minutes then by all means put it on the spreadsheet. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
On Tuesday, October 25, 2011 12:00:04 PM UTC-4, Tim Robinson wrote: This code probably will not make a whole lotta sense since I reduced it down to show only the problem at hand, but I'm hoping someone can explain why this doesn't work the way I expected it would: = (def data (atom {:k1 v1 :k2 v2 :k3 v3})) #'user/data = (def flag (atom nil)) #'user/flag = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) = (oops!) (:k1) nil = @flag {} I had expected this flag would now hold the value from x1, but instead it's empty. No, it's not empty - it holds the value that x1 had at the time you swapped it, which is an empty map. Later, the x1 atom had its value changed, by then it was too late to affect flag. Specifically, x1 changed only when you printed v1, thus forcing realization of the lazy sequence that filter returned. Make sense? - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
ClojureScript Birds of a Feather (I'm not going to lead this one though, but it seems like an obvious add) miniKanren / core.logic Birds of a Feather (I'm open to leading this one) David On Tue, Oct 25, 2011 at 12:16 PM, Fogus mefo...@gmail.com wrote: Please note that nothing is too humble! If you have a cool piece of code or technique that you'd like to show off for 10 minutes then by all means put it on the spreadsheet. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
Yes, that does. Thanks to both of you. Tim On Oct 25, 10:16 am, Chris Perkins chrisperkin...@gmail.com wrote: On Tuesday, October 25, 2011 12:00:04 PM UTC-4, Tim Robinson wrote: This code probably will not make a whole lotta sense since I reduced it down to show only the problem at hand, but I'm hoping someone can explain why this doesn't work the way I expected it would: = (def data (atom {:k1 v1 :k2 v2 :k3 v3})) #'user/data = (def flag (atom nil)) #'user/flag = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) = (oops!) (:k1) nil = @flag {} I had expected this flag would now hold the value from x1, but instead it's empty. No, it's not empty - it holds the value that x1 had at the time you swapped it, which is an empty map. Later, the x1 atom had its value changed, by then it was too late to affect flag. Specifically, x1 changed only when you printed v1, thus forcing realization of the lazy sequence that filter returned. Make sense? - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
BTW, is this meant to be editable by anyone else? Or are you going to collect the ideas off this thread and enter them? David On Tue, Oct 25, 2011 at 12:11 PM, Fogus mefo...@gmail.com wrote: All, We talked about the possibility of getting some ideas about extracurricular activities during the Conj days (and possibly training days). I've created a spreadsheet at the link below to collect ideas. It is not my intention to be the organizer of these activities. Instead, if you have an idea then please be prepared to own it. The matter of space for these activities would need to be worked out by Conj planners or activity organizers, but having a list would help that process. https://docs.google.com/spreadsheet/ccc?key=0Alim_jfrt24MdDFqZVZsNW0tamtQR2pPTHJZTkN6Y0Ehl=en_US I've entered an example, feel free to add your own ideas. :-) This should be epic. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj extracurricular activities spreadsheet
BTW, is this meant to be editable by anyone else? Or are you going to collect the ideas off this thread and enter them? It should be editable by anyone with a Google account. Please let me know if that's not the case. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
Good question. Also, I wonder if there are any existing realize type functions? i.e. (realize (filter ...)) or how would I realize without printing? Tim On Oct 25, 10:12 am, Marshall T. Vandegrift llas...@gmail.com wrote: Tim Robinson tim.blacks...@gmail.com writes: = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) So why didn't the first version with deref work? Because `filter' produces a lazy list, which isn't realized (and the side effects generated) until your call to `println'. Furthermore, the documentation for `filter' explicitly notes that pred must be free of side-effects. Looking at the implementation, I'm not sure why function-argument purity matters more for `filter' than any other sequence-generating higher-order function. Does anyone else know the reason? -Marshall -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
Never mind... I just used 'count'. And sorry to spam the group. On Oct 25, 10:44 am, Tim Robinson tim.blacks...@gmail.com wrote: Good question. Also, I wonder if there are any existing realize type functions? i.e. (realize (filter ...)) or how would I realize without printing? Tim On Oct 25, 10:12 am, Marshall T. Vandegrift llas...@gmail.com wrote: Tim Robinson tim.blacks...@gmail.com writes: = (defn oops! [] (let [x1 (atom (hash-map)) v1 (filter #(let [xv1 (@data %)] (if (= xv1 v1) (swap! x1 assoc :k1 other))) (keys @data)) rxv (reset! flag @x1)] (println v1))) So why didn't the first version with deref work? Because `filter' produces a lazy list, which isn't realized (and the side effects generated) until your call to `println'. Furthermore, the documentation for `filter' explicitly notes that pred must be free of side-effects. Looking at the implementation, I'm not sure why function-argument purity matters more for `filter' than any other sequence-generating higher-order function. Does anyone else know the reason? -Marshall -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code problem: setting an atom from a deref'd atom that's inside a let.
Also, I wonder if there are any existing realize type functions? i.e. (realize (filter ...)) This is what doseq, dorun, and doall are for. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
I'm going to add a column for people to add themselves (either by name or handle) as planning to attend. Even an inaccurate count would help the organizer ensure a proper space is found for the session/workshop/talk/whatever. - Chas On Oct 25, 2011, at 12:11 PM, Fogus wrote: All, We talked about the possibility of getting some ideas about extracurricular activities during the Conj days (and possibly training days). I've created a spreadsheet at the link below to collect ideas. It is not my intention to be the organizer of these activities. Instead, if you have an idea then please be prepared to own it. The matter of space for these activities would need to be worked out by Conj planners or activity organizers, but having a list would help that process. https://docs.google.com/spreadsheet/ccc?key=0Alim_jfrt24MdDFqZVZsNW0tamtQR2pPTHJZTkN6Y0Ehl=en_US I've entered an example, feel free to add your own ideas. :-) This should be epic. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Is there a String protocol?
java.lang.Object.toString On Oct 25, 5:45 am, Sean Devlin francoisdev...@gmail.com wrote: I was wondering if there was a common protocol to get a string representation of an object yet. Also, are there common protocols for ints, doubles, chars, etc? Having just spent a lot of time writing Python, having an int function that worked on both Strings and Ints was great. I'd love to be able to use a protocol for this. Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj extracurricular activities spreadsheet
One idea would be to organize something for people wanting to set up local clojure meetups. I don't think this needs to be a BOF, but I don't know the best way to promote the idea. Anyone coming with family and/or spouse-dates? If so, let us locals know so we can suggest some local activities. -- LinkedIn: http://www.linkedin.com/pub/roger-austin/8/a4/60 Twitter: http://twitter.com/RogerTheGeek Google+: https://plus.google.com/117357905892731200369 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
This is not coding-related, but do we have any musicians in the group? I'm going to have a violin with me and would love to jam or sight-read. Maybe the Overtone guys would be interested in this? If there's any interest I'll set up a doodle poll to see what instruments people might play or have. On Oct 25, 11:10 am, Roger Austin raust...@nc.rr.com wrote: One idea would be to organize something for people wanting to set up local clojure meetups. I don't think this needs to be a BOF, but I don't know the best way to promote the idea. Anyone coming with family and/or spouse-dates? If so, let us locals know so we can suggest some local activities. -- LinkedIn:http://www.linkedin.com/pub/roger-austin/8/a4/60 Twitter: http://twitter.com/RogerTheGeek Google+: https://plus.google.com/117357905892731200369 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
You could just add the session, and ask that attendees indicate their instrument in the attending column? - Chas On Oct 25, 2011, at 3:17 PM, nchurch wrote: This is not coding-related, but do we have any musicians in the group? I'm going to have a violin with me and would love to jam or sight-read. Maybe the Overtone guys would be interested in this? If there's any interest I'll set up a doodle poll to see what instruments people might play or have. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 1.3 wonky behavior
2011/10/25 Micah Martin micahmar...@gmail.com: Right Rich, Thanks. But that was a simplified reduction of real usage. Typically the declare is found in a nested structure: (describe something (context fooey (with bar 42) ; declare comes from this macro (it works (should= 42 @bar ; here bar be unbound I'll see if I can restructure Speclj to get all the Vars declared at the root level. But I'd still like to know…. Is this defined behavior? Or am I jumping through hoops to avoid behavior that doesn't belong? Hi Micah, maybe this can help : do you know you can create / use vars without having to have them declared globally ? See section named non interned vars here : http://clojure.org/vars 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: Is Clojure Simple?
Yes, Easy to track. Nevertheless this definition passes Rich's list. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
java.lang.ClassFormatError: Invalid method Code length
I get the subject error when trying to deserialize a big map (70kb) using load-file. Is this by design? There was an advice in the old thread to use smaller methods. But while small methods are good, breaking continuous data into smaller pieces looks like a hack. Should I use some other function for deserializing data? Currently I use pr-str to serialize and try load-file, load-string, eval read-string to deserialize. Regards, Sergey. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: java.lang.ClassFormatError: Invalid method Code length
On Tue, Oct 25, 2011 at 22:28, Sergey Didenko sergey.dide...@gmail.com wrote: I get the subject error when trying to deserialize a big map (70kb) using load-file. Is this by design? There was an advice in the old thread to use smaller methods. But while small methods are good, breaking continuous data into smaller pieces looks like a hack. Should I use some other function for deserializing data? Currently I use pr-str to serialize and try load-file, load-string, eval read-string to deserialize. load-file will compile what you've given it and then run the resulting code. A data literal results in a method being emitted by the compiler, which when run will produce the desired data structure. A large data literal may cause the method to exceed the 64KB method size limit of the class file format. If it's really just data (not containing function or macro calls you are expecting to be evaluated), just use (read ...). That will parse the file, returning a Clojure data structure without evaluating it. // 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: java.lang.ClassFormatError: Invalid method Code length
Indeed. Thanks for the answer! If it's really just data (not containing function or macro calls you are expecting to be evaluated), just use (read ...). That will parse the file, returning a Clojure data structure without evaluating it. // 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: Is there a String protocol?
On Tue, Oct 25, 2011 at 14:45, Sean Devlin francoisdev...@gmail.com wrote: I was wondering if there was a common protocol to get a string representation of an object yet. Also, are there common protocols for ints, doubles, chars, etc? Having just spent a lot of time writing Python, having an int function that worked on both Strings and Ints was great. I'd love to be able to use a protocol for this. What do you need the string for? Just for presentation (like __str__), or are you hoping to be able to parse it back in again (like __repr__)? (pr-str x) will produce a string representation of x which you can convert back to Clojure data using (read-string s) provided x was composed only of things that are representable as Clojure literals (lists, vectors, maps, sets, keywords, strings, symbols, numbers, chars). The behavior of pr and friends is not defined in a protocol, as such, but rather by the multimethods print-method and print-dup. I suppose one could add behavior for ones own types, but this would be of limited utility since read and friends won't know how to read these representations back in. (str x) produces a string for presentation. This is not necessarily something that can be read back in. This is not defined by a protocol, as such, but rather by overriding the toString(), which all Java classes provide. // 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
Tutorial/examples of pprint dispatch functions
Hello, Are there any tutorials or examples of setting up pprint dispatch functions? I know the docs suggest looking at the source, but I find it a bit cryptic. In particular I would like to see if it's possible to dispatch on meta-data, record types or more arbitrary values in a map etc. thanks, Alasdair -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Software Developer at Amazon.com in Seattle, WA
The Consumer Electronics Customer Experience Team is looking for a senior level passionate software engineer to build a complete e- commerce solution for shopping for electronics. A successful candidate will be an experienced and talented engineer who is excited to work with a team of smart developers to build out our software platform including the customer facing website, the backend services to power our website, and internal tools contributing to our operational excellence. All backend services are developed in Clojure. You will be a significant contributor to our team and to our department. You will have plenty of opportunities to solve complex and broad business problems. Successful candidates should be passionate about providing an exceptional customer experience and writing high quality, well tested, maintainable code. We strive to maintain a reasonable work-life balance through operational excellence and have fun at work. Basic Qualifications * At least five years of relevant software development experience * Outstanding Java or C++ skills * Strong technical leadership skills * Results-oriented with strong emphasis on delivery * Strong customer and business focus * BS in Computer Science or related field * Linux or Unix experience Preferred Qualifications * Experience building complex software systems that have been successfully delivered to customers * Knowledge of professional software engineering practices best practices for the full software development life cycle, including coding standards, code reviews, source control management, build processes, testing, and operations * Ability to take a project from scoping requirements through actual launch of the project * Experience in communicating with users, other technical teams, and management to collect requirements, describe software product features, and technical designs. * Programming experience in Clojure or Scala Apply online @ http://www.amazon.com/gp/jobs/149695 and/or contact me directly (annieg at amazon dot 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: Tutorial/examples of pprint dispatch functions
https://gist.github.com/1314616 On Tue, Oct 25, 2011 at 6:33 AM, Alasdair MacLeod alasdair.clj@gmail.com wrote: Hello, Are there any tutorials or examples of setting up pprint dispatch functions? I know the docs suggest looking at the source, but I find it a bit cryptic. In particular I would like to see if it's possible to dispatch on meta-data, record types or more arbitrary values in a map etc. thanks, Alasdair -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
creating a finite sequence of uncertain length
I have a function without arguments which returns a big,complex object repeatedly until it returns nil. That is to say that the function will produce a sequence of objects, but I don't know how many. I want to call the generator as a lazy sequence but how do I make such a thing? Currently I am doing something like this: (loop [i (myfunc)] (if (nil? i) nil ;; we are done here (let ...do a bunch of stuff to i (recur (myfunc))) This works okay, but leaves that recur statement dangling at the end of the routine. What I would like to do is the cleaner: (doseq [ i (myseq)] ...do a bunch of stuff to i) I have tried using (def myseq (repeatedly (myfunc))), but the repeatedly doesn't seem to ever end. I have tried having myfunc return a nil, or a [] but it just keeps repeating the final end value of nil or []. How would you make such a terminating sequence? Is there a special final value myfunc must return so that the sequence ends gracefully? Or is this just an abuse of the concept of a sequence and I should just stick to the loop? thanks Blake -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: creating a finite sequence of uncertain length
(take-while (complement nil?) (repeatedly myfunc)) On Oct 25, 4:07 pm, rugby_road cabjh...@embarqmail.com wrote: I have a function without arguments which returns a big,complex object repeatedly until it returns nil. That is to say that the function will produce a sequence of objects, but I don't know how many. I want to call the generator as a lazy sequence but how do I make such a thing? Currently I am doing something like this: (loop [i (myfunc)] (if (nil? i) nil ;; we are done here (let ...do a bunch of stuff to i (recur (myfunc))) This works okay, but leaves that recur statement dangling at the end of the routine. What I would like to do is the cleaner: (doseq [ i (myseq)] ...do a bunch of stuff to i) I have tried using (def myseq (repeatedly (myfunc))), but the repeatedly doesn't seem to ever end. I have tried having myfunc return a nil, or a [] but it just keeps repeating the final end value of nil or []. How would you make such a terminating sequence? Is there a special final value myfunc must return so that the sequence ends gracefully? Or is this just an abuse of the concept of a sequence and I should just stick to the loop? thanks Blake -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Blog post declare type implements protocol feature
I recently read the article http://www.colourcoding.net/blog/archive/2011/10/25/clojure-is-a-get-stuff-done-language.aspx?utm_source=feedburnerutm_medium=feedutm_campaign=Feed%3A+ColourCoding+%28Colour+Coding%29 and it mentions in the Better than a better java section, that Compojure defines a protocol called Renderable that allows you to specify how return types get converted into Ring responses. Now, you could apply an adapter pattern in most languages to link these two up. In Clojure, you can declare that a type implements a protocol and it*just works*. You don’t need to extend the type; you don’t need to monkey patch it; you don’t need to introduce a proxy object under your control. What does the author mean by don't need to extend the type but only need to declare that a type implements a protocol? I am familiar with extend, and extend-type, or extend-protocol, but not JUST declaring a type implements a protocol and it magically works. From what I know, you always have to specify the implementation, even if the implementation is simply delegating it to some other function. Best, 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
Idiomatic record construction in 1.3
So I'm catching up with the 1.3 defrecord additions (best docs here afaik: http://dev.clojure.org/display/design/defrecord+improvements - will http://clojure.org/datatypes be updated?) In 1.2, records were constructed only with the positional Java constructor: (defrecord Person [first last]) (Person. alex miller) In 1.3, there are now a plethora of new construction options: Positional: p1) (Person. alex miller) ;; legacy Java constructor form p2) (#user.Person[alex miller]) ;; reader form, ns required p3) (-Person alex miller) ;; factory function Map: m1) (#user.Person{:first alex :last miller}) ;; reader form, ns required, default print form m2) (map-Person {:first alex :last miller}) ;; factory function m3) (Person/create {:first alex :last miller}) ;; static class factory method So my question is what my first choice should be when constructing records and needing positional or map forms? Re positional forms, the p2 reader form requires the ns so is probably more typing than I'm likely to do. I'm guessing that p3 is now preferred over p1 as it hides the interop form. So I'll take p3 as the preferred first choice. For maps, m1 is the default form serialization form but requires the ns, so I doubt I would choose that first. m3 clearly seems designed for tool usage and does Java interop, so I'm guessing m2 is the likely preferred first choice. Thoughts? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Simplicity, and implications on usage of SQL
In the thread about Rich Hickey's talk on simplicity, people bring up the point that Rich suggests to *finally*, learn SQL. The idea is to use declarations to describe your solution, decoupling implementation details. However, its arguable that SQL itself is hard. For example, programmers can often encounter deeply nested SQL statements. One might say the statement is complex and thus harder to understand. What would help is if the SQL statement could be broken up into composable pieces. Pig/Pig Latin [1], is one such example of this, where programmers write imperative (seems more like functional to me), statements, and you can model your data conceptually via input and output through named bindings and operators. My question is this, is it possible to write composable SQL? Named expressions might help (binding a query to a name that you can reuse in another query), but I feel like they may not be enough. In core.match, queries are declarative, but one can write functions that work on query arguments, thus giving composable queries, is this the right approach? Best, Brent [1] http://www.google.com/url?sa=trct=jq=pig%20latin%20sigmod%202008source=webcd=2ved=0CCIQFjABurl=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.134.9888%26rep%3Drep1%26type%3Dpdfei=lWenTquWGqrz0gH7jfW9Dgusg=AFQjCNGNzB3kdxtWW3r-6q3Ts8CWhYrffg -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Simplicity, and implications on usage of SQL
I'm new to clojure but I find the approach [1]Arel takes to SQL very useful. It uses relational algebra to make complex SQL statements composed by smaller structures that represent simple SQL statements. On my current project, we use it as a way to provide the staff will a flexible query builder. They use a fancy UI in the web app to choose the rules they want applied to their query and the code then composes the complex statement by merging all those relations together. It's a really great way to abstract SQL and has done wonders for us in this particular project. [1] https://github.com/nkallen/arel Cheers, Leonardo Borges www.leonardoborges.com On Wed, Oct 26, 2011 at 1:04 PM, Brent Millare brent.mill...@gmail.comwrote: In the thread about Rich Hickey's talk on simplicity, people bring up the point that Rich suggests to *finally*, learn SQL. The idea is to use declarations to describe your solution, decoupling implementation details. However, its arguable that SQL itself is hard. For example, programmers can often encounter deeply nested SQL statements. One might say the statement is complex and thus harder to understand. What would help is if the SQL statement could be broken up into composable pieces. Pig/Pig Latin [1], is one such example of this, where programmers write imperative (seems more like functional to me), statements, and you can model your data conceptually via input and output through named bindings and operators. My question is this, is it possible to write composable SQL? Named expressions might help (binding a query to a name that you can reuse in another query), but I feel like they may not be enough. In core.match, queries are declarative, but one can write functions that work on query arguments, thus giving composable queries, is this the right approach? Best, Brent [1] http://www.google.com/url?sa=trct=jq=pig%20latin%20sigmod%202008source=webcd=2ved=0CCIQFjABurl=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.134.9888%26rep%3Drep1%26type%3Dpdfei=lWenTquWGqrz0gH7jfW9Dgusg=AFQjCNGNzB3kdxtWW3r-6q3Ts8CWhYrffg -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Idiomatic record construction in 1.3
+1 A further argument in favor of your choices is that p3 and m2 both work great with higher-order fns, which I didn't immediately find a way to do with any of the others: user= (map (partial apply -Person) [[bob loblaw] [stan sitwell]]) (#user.Person{:first bob, :last loblaw} #user.Person{:first stan, :last sitwell}) user= (map map-Person [{:first bob :last loblaw} {:last stan :first sitwell}]) (#user.Person{:first bob, :last loblaw} #user.Person{:first sitwell, :last stan}) Thanks for posting this - I knew there were defrecord changes coming at some point, but didn't realize they were already in in 1.3. Hooray! -Colin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
We built quite a large list before the internet graffiti started taking over, so if you have an addition then please post it here and it'll be added. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
I'd suggest adding a header row (in large, bold type, perhaps) that indicates the desired process. - Chas On Oct 25, 2011, at 10:25 PM, Michael Fogus wrote: We built quite a large list before the internet graffiti started taking over, so if you have an addition then please post it here and it'll be added. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj extracurricular activities spreadsheet
Like to attend the Go and Literate Programing sessions. On Oct 25, 10:25 pm, Michael Fogus mefo...@gmail.com wrote: We built quite a large list before the internet graffiti started taking over, so if you have an addition then please post it here and it'll be added. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
Please add me to Clojure and the web, Luc P. On Tue, 25 Oct 2011 22:25:41 -0400 Michael Fogus mefo...@gmail.com wrote: We built quite a large list before the internet graffiti started taking over, so if you have an addition then please post it here and it'll be added. -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj extracurricular activities spreadsheet
Very nice collection of Clojure goodness. The Conj is shaping up to be great! On Oct 25, 2011 11:26 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Please add me to Clojure and the web, Luc P. On Tue, 25 Oct 2011 22:25:41 -0400 Michael Fogus mefo...@gmail.com wrote: We built quite a large list before the internet graffiti started taking over, so if you have an addition then please post it here and it'll be added. -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
On Tue, Oct 25, 2011 at 8:26 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Please add me to Clojure and the web, Me too please. I already added myself to Clojure Tooling before the document got locked down :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj extracurricular activities spreadsheet
me too! :) On Tue, Oct 25, 2011 at 11:38 PM, Sean Corfield seancorfi...@gmail.comwrote: On Tue, Oct 25, 2011 at 8:26 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Please add me to Clojure and the web, Me too please. I already added myself to Clojure Tooling before the document got locked down :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Conj extracurricular activities spreadsheet
Fogus, Please add me to ClojureScript, MiniKanren, Go and the Heroku drinkup. Regards, BG --- Sent from phone, please excuse brevity. On Oct 26, 2011 10:03 AM, Robert Levy r.p.l...@gmail.com wrote: me too! :) On Tue, Oct 25, 2011 at 11:38 PM, Sean Corfield seancorfi...@gmail.comwrote: On Tue, Oct 25, 2011 at 8:26 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Please add me to Clojure and the web, Me too please. I already added myself to Clojure Tooling before the document got locked down :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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