Re: labrepl: kl...@feersum:~/projects/labrepl$ script/repl java.lang.ExceptionInInitializerError (control.clj:9)
now, _that's_ what I call a bright idea! :-) Thank you very much /klang On Fri, Apr 30, 2010 at 11:06 AM, Alex Osborne a...@meshy.org wrote: klang karstenl...@gmail.com writes: laprepl starts up with the following error and localhost:8080 does not respond kl...@feersum:~/projects/labrepl$ script/repl Clojure 1.2.0-master-SNAPSHOT java.lang.ExceptionInInitializerError (control.clj:9) Looks like labrepl is not locked to a particular version of Clojure and so is using the very latest bleeding edge. Seems to be a conflict with some of the newly added functions and compojure. Hopefully Stuart will fix this soon, but in meantime you can just use a version of Clojure that's a few days old. To do this simply: 1. Edit labrepl/project.clj. Change the version for org.clojure/clojure from 1.2.0-master-SNAPSHOT to 1.2.0-master-20100422.180114-42 2. Remove the jar: $ rm lib/clojure-1.2.0-* 3. Download the selected version: $ lein deps 4. Try again running the repl again: $ script/repl Hopefully that should do the trick. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: labrepl: kl...@feersum:~/projects/labrepl$ script/repl java.lang.ExceptionInInitializerError (control.clj:9)
It works, thank you! (Initially, I had missed the bright idea of just using a version a few days old .. but then again, then it would be a few more days before problems were found) /klang On Fri, Apr 30, 2010 at 3:35 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: I will check in a fix later this morning. Stu klang karstenl...@gmail.com writes: laprepl starts up with the following error and localhost:8080 does not respond kl...@feersum:~/projects/labrepl$ script/repl Clojure 1.2.0-master-SNAPSHOT java.lang.ExceptionInInitializerError (control.clj:9) Looks like labrepl is not locked to a particular version of Clojure and so is using the very latest bleeding edge. Seems to be a conflict with some of the newly added functions and compojure. Hopefully Stuart will fix this soon, but in meantime you can just use a version of Clojure that's a few days old. To do this simply: 1. Edit labrepl/project.clj. Change the version for org.clojure/clojure from 1.2.0-master-SNAPSHOT to 1.2.0-master-20100422.180114-42 2. Remove the jar: $ rm lib/clojure-1.2.0-* 3. Download the selected version: $ lein deps 4. Try again running the repl again: $ script/repl Hopefully that should do the trick. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: clojure 1.2 seq fn enhancement FAQ
On Apr 30, 2010, at 14:33 , Rich Hickey wrote: 'contains?' and 'get' abstract over fast lookup. They are polymorphic on the collection type and on the nature of the looked-up thing. For maps the looked-up thing is a key, for sets: a value, for vectors, strings and arrays: an index. Calling it contains-key? doesn't make them the same, nor add any value. I think if contains? and get are in 'the same group' the names should reflect that, readability of code and expressive names are very important if someone reads (contains? [1 2 3] 3) he will assume it to be true and I bet about 90% of the people using clojure will make this miss assumption since people think english first and clojure second. if I they read (contains-key? [1 2 3] 3) they will think twice, 'key on a vec, oh index yes so it is false' if they read (contains-val? [1 2 3] 3) they will also think twice, 'val on a vec, ah yes means if it include that value'. In Clojure, 'contains?' is about 'get' succeeding. Nothing more or less. It is not a rummager. (if (contains? coll x) (get coll x) (plan-b)) Then ow about can-get? since contains does not actually look of the passed thing contains anything it is just looking of you can get stuff from it, you sayed it yourself: (if (can-get? coll x) (get coll x) (plan-c-as-c4) Renaming contains? is not on the table. For people that understand its relationship with get, it makes perfect sense (and I don't think I'm the only one :). And there is a lot of client code. And no one has come up with a better name that doesn't include caveats. contains? is internally consistent, is unfamiliar. Sorry I disagree here, I now understand the relationship with get and it makes even less sense to me then before -.- if it has to do with get contains? is a very very bad name. Think about translating stuff to real world examples, if I ask you 'does your bag contains x' I don't want to know if the bag has more then x items I want to know if x is in there. Whenever we use contains we talk about the content in the real world. Even if we use it with indices as in 'does this book contains page 42' we clarify that we are talking about the index by adding 'page' in there, if we ask 'does this book contains 42' people will likely start to look if there is a 42 in the book, and if it is the hitchhikers guide to the galaxy the answer is yes, otherwise most likely no. So pretty pretty please reconsider the decision about renaming contains I do understand that this use of the word differs from that used in e.g., Java. But I'll make the same argument to Java devs that I do to the Lispers, who have seen many more of their prized words repurposed in Clojure (assoc, loop, do et al): The words can't mean the same thing forever without trapping us in the same semantics forever, and there are only so many good words. But choosing a misleading name just for the sake of chaining the semantics is not the way to go! Everyone has to realize that this level of polymorphism in Clojure is unusual. I haven't seen a library with equivalents to get and contains?. Heck, in Java, Maps aren't even collections! So, should we adopt their nomenclature because it is familiar? Trust me I don't care how java uses contains? that isn't an argument I would raise, but I care about how the human mind, uses contains, and currently it is different to the usage in clojure. I agree that contains?'s behavior on vectors is confusing for newcomers. That's not a reason for it to be different. And that people need a way to do that rummaging job. They of course can, with 'some'. But I also agree that 'some', being a higher-order function, would not necessarily be the tool newcomers would consider for the job of rummaging for a value. Perhaps it's a good first lesson, as they are not going to find filter-val etc either. I am pretty certain the behaviour of contains? is confusing even to somewhat versed people, just that at some point people resign and put back comen sense and let clojure do it's thing with contains?, but this isn't a good thing in my eyes :(. Also 'does this collection contains the value X' is a quite common idiom isn't it? so why force a higher order function onto that? So, I pulled in 'includes?' from contrib and renamed it seq-contains? The only options for right now are: A) I remove seq-contains? B) I rename seq-contains? :.( Regards a sad, Heinz -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: something stupid I'm trying to do
On 1 May 2010 03:19, Mark J. Reed markjr...@gmail.com wrote: Another version: (defn pairup [ args] (map vector args (rest args))) Nope, that doubles the middle elements: user= (pairup 1 2 3 4) ([1 2] [2 3] [3 4]) Ouch, right, forgot to include take-nth: (defn pairup [ args] (take-nth 2 (map vector args (rest args I was curious to see how much of a problem the building of vectors would be for the simple case of (apply pairup (range 2)). Preliminary timing data indicates that this version has slightly longer running times with a larger variance; fastest runs for this pairup and the explicit cons pairup are about the same, but this pairup slows down to up to 2x that time per run much more often than the explicit cons pairup does (plus there are more super-long runs). Both go through (range 2) in somewhere between 7 and 62 ms, so it might be pointless to even go on measuring this with more precision. But I'll still post this in case somebody else would enjoy a silly microbenchmarks at this time too. :-) Sincerely, Michał -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Try + finally question
Hmm .. makes sense .. my thinking was its just a more flexible with- open ... but from user's pov with-open-close is better... Thanx On Apr 29, 2:24 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Maybe juste the name ? wouldn't with-open-close be a better reminder of how the bindings are constructed ? 2010/4/29 Alex Osborne a...@meshy.org: ka sancha...@gmail.com writes: Above I wrote a macro with-open-flexi! ... which I'm planning to use in my app's API . .. please let me know if there are any bugs / gotchas / improvements etc... I didn't get any responses, so does it means there is something so obviously wrong that you can't even begin where to start :) (I doubt so) or does it looks OK ..? It looks okay to me, nothing obviously stands out as wrong with it. :-) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://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: something stupid I'm trying to do
Um, got a typo in there; up to 2x that time was meant to be up to 3x that time. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure 1.2 seq fn enhancement FAQ
If contains? is a sensible name for that function, then surely seq-contains? cannot be a sensible name for a function which checks a totally different sort of containment? Also, if it is possible to view seq-contains? as a sensible enough name for a core library function with sequential semantics, then surely contains? cannot be intrinsically evocative of a different notion of containment, even if it is possible to get used to this word being attached to such a notion. Incidentally, I have personally got used to the Clojure meaning of contains? without great difficulty, so I was initially a bit surprised by this thread exploding to such length... But then contains? is a very desirable name and in hindsight, a controversy over which op it should be attached to was to be expected. Not just because it's cool to have such a good name at one's disposal, but because any other notion of containment is bound to get a substandard name (if indeed it slips into the core lib at all), because every other good name will be totally confused with contains? by everyone and is therefore out of the game (cf. includes?). Using a few variant names (like the proposed ones based on contains?, but with disambiguating affixes attached) could be a reasonable compromise. (Although I'd be a little bit sad that the perfect name is gone, its sacrifice would mean two reasonable names become available.) If that is unacceptable, then perhaps seq-contains? could at least get a name *not* including the contains? part, so that it becomes natural not to assume that it does roughly the same thing as contains?. (There's precedent for prefixes meaning do mostly the same thing, but in a different context in Clojure, e.g. enumeration-seq, iterator-seq.) To end on a punnish note, I'd sort of expect the predicate counterpart of get to be called got?... Oh well. At the end of the day, I'm confident that the overall greatly considered design of Clojure (including naming conventions) is internally consistent enough that it can be conveyed to a newcomer with a reasonable amount of good technical writing. Apparently most people think the same and are therefore quite prepared to move on. :-) All the best, Michał -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: rand-int with bignums
Sorry, the expression in my first sentence should have been (. (new java.util.Random) (nextInt X)), not (. (new java.util.Random) X). In any event the real question isn't about this call but about how Clojure's rand-int should handle bignum arguments and about how to write a real random bignum generator. -Lee On Apr 30, 2010, at 10:56 PM, Lee Spector wrote: In an earlier thread, in which I learned (from Timothy Pratley) that (. (new java.util.Random) X) gives an error if X is a bignum, I said that at least Clojure's rand-int does the right thing. Upon further investigation I see that this is only true in the sense that it doesn't produce an error. In fact it does something that seems pretty odd to me, at least in Clojure 1.1.0 / Java 1.6.0_17, which is all I've tried. It does seem to return a random integer between 0 and 2^31-1 but it rather frequently returns exactly 2^31-1 (which is 2147483647): user= (rand-int 100) 2035176337 user= (rand-int 100) 2147483647 user= (rand-int 100) 2147483647 user= (rand-int 100) 2147483647 user= (rand-int 100) 1859741466 user= (rand-int 100) 2147483647 user= Looking at the source I see that it calls int which overflows with bignums (whether by design or not I don't know): user= (int 2147483648) -2147483648 I don't immediately see why this would would cause rand-int to produce 2147483647 so many times... maybe it's somehow an interaction with the resolution of the float from the call to rand? In any event I guess this is somehow the source of the behavior. Anyway, for my present application this doesn't matter much -- I'm just punting and using 2147483647 as the limit if I'm given a bignum -- but: - Mightn't rand-int be written to really do the right thing and return a random integer between 0 (inclusive) and n (exclusive), even if n is a bignum? - If there's a reason that rand-int shouldn't do this then is there another straightforward way get the same effect, maybe with some java library that I don't know about? Thanks, -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.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 -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.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: rand-int with bignums
On Sat, May 1, 2010 at 7:25 PM, Lee Spector lspec...@hampshire.edu wrote: about how to write a real random bignum generator. Let n be the bignum upper bound on the desired range. Find the quotient q and remainder r of n by b = 2^31-1. Generate q random numbers with upper bound b and one random number with upper bound r. Now use Horner's method to reconstruct a random bignum from these random fixnum parts with q additions and multiplications. This is adding uniformly distributed random variables with disjoint but abutting ranges. Therefore the sum is again a uniform random variable. -Per -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: rand-int with bignums
Hmm, actually, that doesn't give numbers in the right range because of the way the remainder is handled. You could round up the remainder to the nearest power of two and then generate random coefficients using rejection sampling but that's not as nice as a closed form solution. Probably any of the textbook algorithms for generating non-power-of-two random numbers from random bit streams should apply to this kind of situation. -Per On Sat, May 1, 2010 at 8:48 PM, Per Vognsen per.vogn...@gmail.com wrote: On Sat, May 1, 2010 at 7:25 PM, Lee Spector lspec...@hampshire.edu wrote: about how to write a real random bignum generator. Let n be the bignum upper bound on the desired range. Find the quotient q and remainder r of n by b = 2^31-1. Generate q random numbers with upper bound b and one random number with upper bound r. Now use Horner's method to reconstruct a random bignum from these random fixnum parts with q additions and multiplications. This is adding uniformly distributed random variables with disjoint but abutting ranges. Therefore the sum is again a uniform random variable. -Per -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: rand-int with bignums
Lee Spector lspec...@hampshire.edu writes: Sorry, the expression in my first sentence should have been (. (new java.util.Random) (nextInt X)), not (. (new java.util.Random) X). In any event the real question isn't about this call but about how Clojure's rand-int should handle bignum arguments and about how to write a real random bignum generator. Also take a look a the BigInteger class' constructors. Some of them take a Random object and generate a number in a range up to given power of two. Presumably you can use this as a starting point. If you need high quality numbers it's probably also worth looking into a cryptographic random number generator library, rather than using java.util.Random. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Concurrency Screencast Available
interesting so far. the format I first tried didn't work on my droid, but no big deal. one, kind-of Eureka moment I just had, which is somewhat blasphemous, I guess: Craig is going through how a vector is [1 2 3] but a list has to be '(1 2 3)? Well, that may be one of the turn-offs people have from other languages. Can you imagine how disruptive it would be at this point to do it the other way around? If you were starting out today without any Lisp baggage, it seems TOTALLY obvious to me that lists would have been (1 2 3), and the *calling of a function* would have been the different thing ... now that these other data structures represent themselves symbolically (vectors, sets, maps). The quote symbol (or other) should have been to call the function. That would make much more sense, but I doubt making a syntax like that would earn one many friends. Oh well, I'll keep watching. Starting out very nice. On Sat, Apr 10, 2010 at 3:06 PM, Craig Andera craig.and...@gmail.comwrote: Mobile downloads are available now. Sorry about the delay. The refs module is also up, so that's five of six. Part six by mid next week. On Sat, Apr 10, 2010 at 9:26 AM, Craig Andera craig.and...@gmail.comwrote: Right, good point: I should have seen that coming given the target audience. :) Within a few hours, a mobile download link will appear with wmvs and mp4s in a variety of resolutions so you can watch these offline on the device of your choosing. The conversion lags the rest of the process a little bit, but I'm told the upload is in progress now. Hope that helps. On Fri, Apr 9, 2010 at 7:22 PM, Jeff Heon jfh...@gmail.com wrote: I must say I appreciate video sharing sites like blip.tv and Vimeo that allows one to download and watch their videos offline. Very practical for those commuting and using portable devices 8) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@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 box: Problem with classpath (noob question)
Hello Shawn, thank you for help. Yes, I am using Clojure Box 1.1.0. I changed my .emacs-file to: (setq swank-clojure-classpaths (list c:/Clojure)) I still get the same error. Since I am a total emacs newbie, I might be making a stupid mistake that might not be obvious to advanced users. Anything else I could try? On 30 Apr., 19:27, Shawn Hoover shawn.hoo...@gmail.com wrote: On Thu, Apr 29, 2010 at 6:58 PM, Rainer wolf.rai...@gmail.com wrote: Hello, I'm stuck with Programming Clojure on page 37 on a Windows 7 machine. After downloading the examples dir into C:/clojure, I typed: user (require 'examples.introduction) and I got ; Evaluation aborted. java.io.FileNotFoundException: Could not locate examples/ introduction__init.class or examples/introduction.clj on classpath: (NO_SOURCE_FILE:0) My .emacs file looks like this: (setq swank-clojure-extra-classpaths (list C:/Clojure)) I'm not sure what version of Clojure Box you have, but in 1.1 you should set swank-clojure-classpath, not swank-clojure-extra-classpaths. Shawn -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://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: something stupid I'm trying to do
much thanks for the insight-giving answers from you all On Apr 30, 12:29 pm, Mark J. Reed markjr...@gmail.com wrote: On Fri, Apr 30, 2010 at 12:25 PM, Mark J. Reed markjr...@gmail.com wrote: I got an error when I tried ([a b]) instead of (list [a b]), by the way: Clojure 1.1.0 user= (cons [1 2] ([3 4])) java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentVector (NO_SOURCE_FILE:0) To be clear, that's because vectors are functions on their indices; I meant to explain why I had to use the (list) form. -- Mark J. Reed markjr...@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 athttp://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: labrepl updated
I'm getting an error using labrepl in Eclipse. I followed these instructions: http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Eclipse_and_Counterclockwise. This is what I get: Clojure 1.2.0-master-SNAPSHOT 1:1 user= * (require 'labrepl) * (labrepl/-main) #core$_STAR___3860 clojure.core$_star___3...@67da java.lang.ExceptionInInitializerError (control.clj:9) 1:2 user= #core$_STAR___3860 clojure.core$_star___3...@67da java.lang.Exception: No such var: labrepl/-main (repl-1:2) On Apr 30, 2:56 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: I have updated the labrepl [1] to use the latest clojure 1.2 and contrib 1.2 snapshots. Also, most of the dependencies are now frozen to specific snapshot timestamps (the project.clj file may be of interest to people living on the development edge). After a lein clean; lein deps everything should work, please let me know if you see otherwise. Have a good weekend! Stu [1]http://github.com/relevance/labrepl -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://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: labrepl updated
I'm getting this error in Eclipse: Clojure 1.2.0-master-SNAPSHOT 1:1 user= * (require 'labrepl) * (labrepl/-main) #core$_STAR___3860 clojure.core$_star___3...@60ded0f0 java.lang.ExceptionInInitializerError (control.clj:9) 1:2 user= #core$_STAR___3860 clojure.core$_star___3...@60ded0f0 1:3 user= java.lang.Exception: No such var: labrepl/-main (repl-1:2) Do you maybe have an idea what I'm doing wrong? On Apr 30, 2:56 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: I have updated the labrepl [1] to use the latest clojure 1.2 and contrib 1.2 snapshots. Also, most of the dependencies are now frozen to specific snapshot timestamps (the project.clj file may be of interest to people living on the development edge). After a lein clean; lein deps everything should work, please let me know if you see otherwise. Have a good weekend! Stu [1]http://github.com/relevance/labrepl -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://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: something stupid I'm trying to do
(def even-nums [1 2 3 4 5 6 7 8]) (defn pairup [collection] (loop [coll collection results []] (if ( (count coll) 0) (recur (drop 2 coll) (conj results (take 2 coll))) results))) user (pairup even-nums) [(1 2) (3 4) (5 6) (7 8)] On Apr 29, 12:32 pm, john.holland jbholl...@gmail.com wrote: I'm pounding my head against the wall trying to understand how to do a simple task. What I want to do is write a function that will take a even-numbered set of numbers and split them into pairs. What I have right now is the following user (defn pairup ([a b] [a b])([a b rest] (cons (pairup a b) (apply pairup rest))) ([] [] )) #'user/pairup user (pairup 1 2 3 4 5 6 7 8) ([1 2] [3 4] [5 6] 7 8) user I can't get the last pair into a vector like the others. Can someone tell me what I am doing wrong? I know there is probably a way using the language to do this but I ended up trying to do it from scratch as a learning exercise. Thanks 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 athttp://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: something stupid I'm trying to do
On Fri, Apr 30, 2010 at 2:30 PM, Michael Wood esiot...@gmail.com wrote: On 30 April 2010 18:25, Mark J. Reed markjr...@gmail.com wrote: [...] (defn pairup ([a b] (list [a b])) ([a b rest] (cons [a b] (apply pairup rest Why not: (defn pairup ( [] nil ) ( [ a b rest ] ( cons [ a b ] ( apply pairup rest ) ) ) ) (or do you want to force at least two elements be present?) Oh, and Hi!, I'm new here :) -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: rand-int with bignums
On Fri, Apr 30, 2010 at 8:56 PM, Lee Spector lspec...@hampshire.edu wrote: In an earlier thread, in which I learned (from Timothy Pratley) that (. (new java.util.Random) X) gives an error if X is a bignum, I said that at least Clojure's rand-int does the right thing. Upon further investigation I see that this is only true in the sense that it doesn't produce an error. You're right. Under Clojure 1.1.0, I ran the following: (def count-if (comp count filter)) (count-if #(= 2147483647 %) (take 1000 (repeatedly #(rand-int 100 Just running once, it shows that 2147483647 occured 802 times in a thousand, which is... er, not so random. This looks like a side effect of a really screwy coercion to int that just shouldn't happen. And in fact, in versions of clojure more recent than commit d0e1eef2, you get a much more sensible error: user= (int 100) java.lang.IllegalArgumentException: Value out of range for int: 100 (NO_SOURCE_FILE:0) Of course, you might actually *want* a few really large random numbers. In clojure.contrib.math, we have 'round' which can help you make some big numbers: (take 10 (repeatedly #(round (rand 10 Of course, at some point, the resolution of the Double that Java returns from its built-in 'rand' function will cause some problems for the distribution of your really big numbers, since Java's 'rand' returns a number between 0 and 1 that Clojure multiplies by the parameter. Then, I'd see what the incanter folks would recommend, since they probably know more about big random numbers than I do. Have fun! -- Chris Riddoch -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: rand-int with bignums
Sorry, it just occurred to me after I hit send: (defn huge-random-number [digits] (BigDecimal. (apply str (take digits (repeatedly #(rand-int 10)) user= (defn huge-random-number [digits] (BigDecimal. (apply str (take digits (repeatedly #(rand-int 10)) #'user/huge-random-number user= (huge-random-number 100) 35105964899366189896488658213090059861847325348267398238260119141785502595497990954121520505729M There's no guarantee that it *will* be that many digits, because if the first digit happens to be zero, it'll be less. Details... -- Chris Riddoch -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Debugger REPL feature request
Clojure is awesome, no doubt. But I feel it is distinctly lacking a feature that would make it a power-house lisp. I was working with MIT scheme the other day and I noticed just how very nice having a debug break in the repl is. Once can look at the bindings, execute programs within a particular frame, etc. MIT Scheme has a very nice IDE(Edwin) based debugger too. Of course this is expected as standard by all Common Lisp and Smalltalk users. Periodically people do look for such a feature in clojure. I saw at least a few threads here about this subject. I have the following questions: 1) Is such a feature based on a Condition system? Meaning, is a Condition system necessary to have a fully featured debugger? I am not well versed in implementation details, am merely an applications developer. So please do enlighten. 2) As Clojure-in-clojure is implemented, is there any plan to include such features? Or do we just live with JVM based exceptions stack trace and Java based debuggers. Our lot in life. How many ever tools like Mission Control or VisualVM the jvm people may put out there, those just don't cut it when it comes to repl based developing. 3) I suppose something more meaningful needs to be printed out in the stack trace. Will Clojure-in-clojure have a proper type system as well? Instead of relying on JVM/Java class types? Meaning, when I type + in repl to see what it is bound to, I won't be seeing much of the following kinds of things in the repl -- #core$_PLUS___3649 clojure.core$_plus___3...@160e8a2. Instead when I ask the repl what + is bound to, it'll nicely tell me that it is a compiled function or some such. Having a language based debugger, like the one most CL systems do, is a VERY VERY nice feature that makes a heck of a lot of difference to a person thinking the lisp way. It keeps the programmer in the flow and doesn't break it. In my opinion, it makes the repl 10 times more powerful. People coming in from C++, Ruby, Python, Java, etc background won't miss such things much. But people who started off with their programming life with Common Lisp or MIT Scheme will sorely miss them. This is a request for serious consideration of a repl debug system with the ability to look at bindings in stacks and execute expression is a particular frame. It will be great if other people from CL/ Smalltalk background pitched in and explained just how useful this will be. Whatever your response may be to these questions, please just don't say that Exceptions is the JVM way and that is what clojure will do. If that was the attitude, we will all be using Java and eclipse. And no one will look forward to features like InvokeDynamic and TCO. Thanks for the continuing exceptional effort with Clojure. It is a joy to program in. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Any Clojure job out there?
I think the winds are changing out there with regards to company's willingness to explore multiple or alternative languages. Compass Labs is a silicon valley based social media startup company. Their data mining team just switched all their internal tools and data mining work to Clojure (production infrastructure is mostly Java/Scala/ C) and they're currently hiring for two positions and would give preference to qualified people with strong Lisp or Clojure backgrounds: 1) Senior machine learning engineers and/or team leads 2) Clojure infrastructure consultant They will make accommodation for outstanding engineers that don't quite fit the job spec. A significant Clojure project is necessary for the consulting position however. Ian On Apr 18, 9:59 am, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, I've been having lots of fun in the past months working in Clojure only on my own time and wonder if there's opportunities to be paid for it. Our community is growing everyday and I've heard that Clojure is being more and more used in the real world. So, is there anyjob opening for us Clojurians? P.S.: I don't want this post to be just for me, so I encourage you to postjoboffers from anywhere even if you're not searching for telecommuters. BTW, I'm in Montreal. Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://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: Debugger REPL feature request
On Sat, May 1, 2010 at 1:04 PM, JS kayokid@gmail.com wrote: I was working with MIT scheme the other day and I noticed just how very nice having a debug break in the repl is. Once can look at the bindings, execute programs within a particular frame, etc. MIT Scheme has a very nice IDE(Edwin) based debugger too. Of course this is expected as standard by all Common Lisp and Smalltalk users. Have you read about this? http://hugoduncan.org/post/2010/swank_clojure_gets_a_break_with_the_local_environment.xhtml Whatever your response may be to these questions, please just don't say that Exceptions is the JVM way and that is what clojure will do. If that was the attitude, we will all be using Java and eclipse. And no one will look forward to features like InvokeDynamic and TCO. If you are going to interact with other libraries on the JVM, you must be capable of handling Java exceptions. You can use tools like contrib's error-kit to offer CL-style condition restarts in your own code, but you'll always have to deal with code that you don't control. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Trouble with Leiningen and Autodoc
This is my project.clj: (defproject fnparse 3.α.3 :description A library for creating functional parsers in Clojure. :dependencies [[org.clojure/clojure 1.2.0-master-SNAPSHOT] [org.clojure/clojure-contrib 1.2.0-master- SNAPSHOT]] :dev-dependencies [[autodoc 0.7.0]]) I run lein deps, and it works. But then I run lein autodoc, and I get the following: [null] #CompilerException java.lang.ExceptionInInitializerError (autodoc.clj:1) [null] Make sure autodoc is added as a dev-dependency in your project.clj. Do I need to do something else? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Concurrency Screencast Available
And ... in another Ah-ha based on an email I just received on this subject ... what should really be said here is that there should be an explicit symbol to say that the first argument of the list is receiving special treatment (the words of the emailer). Well, that got me thinking: Now I know what the symbol should really be! It should be the number zero (or one if you prefer one-based things). so (+ 1 2) is just three symbols, but 0(+ 1 2) means the first argument is the function. That makes 1(1 + 2) easy. Oh and while we are at it, then things like all the funky, confusing arrows are easy, too. You could have t(...) for thread and tf(...) for thread first (if that's different from thread) ... tl(...) for thread last. and you could have n(...) for postfix. wow. this seems powerful to me, and more obvious. Another choice would have been to use something else for lists, like 1 2 3, but I guess that would have looked a little too much like templates or html (more blasphemy). On Sat, May 1, 2010 at 11:30 AM, e evier...@gmail.com wrote: interesting so far. the format I first tried didn't work on my droid, but no big deal. one, kind-of Eureka moment I just had, which is somewhat blasphemous, I guess: Craig is going through how a vector is [1 2 3] but a list has to be '(1 2 3)? Well, that may be one of the turn-offs people have from other languages. Can you imagine how disruptive it would be at this point to do it the other way around? If you were starting out today without any Lisp baggage, it seems TOTALLY obvious to me that lists would have been (1 2 3), and the *calling of a function* would have been the different thing ... now that these other data structures represent themselves symbolically (vectors, sets, maps). The quote symbol (or other) should have been to call the function. That would make much more sense, but I doubt making a syntax like that would earn one many friends. Oh well, I'll keep watching. Starting out very nice. On Sat, Apr 10, 2010 at 3:06 PM, Craig Andera craig.and...@gmail.comwrote: Mobile downloads are available now. Sorry about the delay. The refs module is also up, so that's five of six. Part six by mid next week. On Sat, Apr 10, 2010 at 9:26 AM, Craig Andera craig.and...@gmail.comwrote: Right, good point: I should have seen that coming given the target audience. :) Within a few hours, a mobile download link will appear with wmvs and mp4s in a variety of resolutions so you can watch these offline on the device of your choosing. The conversion lags the rest of the process a little bit, but I'm told the upload is in progress now. Hope that helps. On Fri, Apr 9, 2010 at 7:22 PM, Jeff Heon jfh...@gmail.com wrote: I must say I appreciate video sharing sites like blip.tv and Vimeo that allows one to download and watch their videos offline. Very practical for those commuting and using portable devices 8) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@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 Concurrency Screencast Available
e evier...@gmail.com writes: Can you imagine how disruptive it would be at this point to do it the other way around? If you were starting out today without any Lisp baggage, it seems TOTALLY obvious to me that lists would have been (1 2 3), and the *calling of a function* would have been the different thing ... now that these other data structures represent themselves symbolically (vectors, sets, maps). Interesting, although in the case of idiomatic Clojure it's actually very rare to want to use a list literal. Most of the places you'd use a list literal in other lisps, a vector probably makes more sense in Clojure. I'm also not sure the code-is-data thing works so well when you reverse quotation like that as it means you'd have quotes on every nested level instead of just the outside, which would make macros more difficult to write (at least without any other changes), but I may be misunderstanding your idea. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 Concurrency Screencast Available
doesn't sound like you are misunderstanding. Data is data, first and foremost in that model. you have to work to turn something into a function. other than functions, everything is data. That's the JSON way, for sure. When something is a function, you see things like eval and function in javascript, at least. But they only have two types, arrays and objects (dictionaries). On Sat, May 1, 2010 at 11:06 PM, Alex Osborne a...@meshy.org wrote: e evier...@gmail.com writes: Can you imagine how disruptive it would be at this point to do it the other way around? If you were starting out today without any Lisp baggage, it seems TOTALLY obvious to me that lists would have been (1 2 3), and the *calling of a function* would have been the different thing ... now that these other data structures represent themselves symbolically (vectors, sets, maps). Interesting, although in the case of idiomatic Clojure it's actually very rare to want to use a list literal. Most of the places you'd use a list literal in other lisps, a vector probably makes more sense in Clojure. I'm also not sure the code-is-data thing works so well when you reverse quotation like that as it means you'd have quotes on every nested level instead of just the outside, which would make macros more difficult to write (at least without any other changes), but I may be misunderstanding your idea. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@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