Re: Dead easy start with Clojure on windows
On Apr 15, 1:51 am, Kasim wrote: > Here are what you need to get started: > 1. Download ClojureW.zip and Unzip to a folder 0. Try to find the link to download. -- Zmitro Lapcionak -- 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
do we have is-delivered? for promise
Hi, is there any nonblocking way I kind find out whether a promise has been delivered? Thanky you, alux -- 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: platform-specific unit test failures in cc.test-complex-numbers
More oddness: If I remove all unit tests *except* test-compex-numbers, all is well: [INFO] [clojure:test {execution: test-clojure}] Testing clojure.contrib.test-complex-numbers Ran 8 tests containing 268 assertions. 0 failures, 0 errors. If I remove only test-complex-numbers, leaving all other tests in place, all is also well: ... Ran 351 tests containing 991 assertions. 0 failures, 0 errors. // 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: do we have is-delivered? for promise
Not currently. I added the capability to some code I posted last month for fixing print-method for promises so they aren't auto-dereferenced when undelivered: (defn promise? [p] (isa? (type p) ::Promise)) (defn promise-delivered? [p] (zero? (.getCount (:d p (defmethod print-method ::Promise [writer p] ((get-method print-method clojure.lang.IDeref) writer p)) (defn promise "Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block. All subsequent derefs will return the same delivered value without blocking." [] (Promise (java.util.concurrent.CountDownLatch. 1) (atom nil))) But there are good reasons for why you might want to discourage this kind of checking in user code. When each promise can only be written by a single writer (i.e. there is not a race among several potential writers to first deliver the promise) then the input-output behavior of readers is deterministic only if such checking is disallowed. Under such conditions it doesn't matter if the readers try to dereference the promise before or after it is ultimately delivered by the writer. If readers can check the status of the promise, then you can get races between readers and the writer. -Per On Sat, Apr 17, 2010 at 7:00 PM, alux wrote: > Hi, > > is there any nonblocking way I kind find out whether a promise has > been delivered? > > Thanky you, alux > > -- > 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: do we have is-delivered? for promise
On 17 April 2010 16:46, Per Vognsen wrote: > Not currently. I added the capability to some code I posted last month > for fixing print-method for promises so they aren't auto-dereferenced > when undelivered: Personally, I would prefer them never to be dereferenced for printing... In fact, I would prefer all reference types to be printed in a manner which does not include their values. That would make my life easier at the REPL (which is the only place where I care to have instances of reference types actually printed and where I can always dereference them by hand if I feel any curiousity about their values...). Not that this is particularly related to the OP's question except by virtue of having come to my mind immediately upon reading it... 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: Java interop question: proxy or gen-class?
> Many thanks to Meikel Brandmeyer, whose code (after a one-character typo correction) worked the first time. As soon as I saw it, I understood every line of it; the problem was, it wouldn't have occurred to me to put all those elements (which, individually, I understood) together in just that way. Meikel, thanks again for contributing to a frustrated newcomer's education. > > By the way, I recommend comparing the original Java source code to the final version (at http://gist.github.com/369239) to any newcomer who wants to learn how to write Java code within a Clojure program--you don't even have to be interested in Piccolo2D to learn from this. (May you have) Good coding! Nice, thanks for posting your efforts with this. Piccolo's zoomable UI is pretty interesting, and I've been wanting to play with it for quite a while. Too many other projects; I hadn't taken the time to go into it. Putting it together with Clojure, and having a nice little sample of it to try out, brings it closer to the front of the line for me. Much appreciated! Kevin Kelley -- 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: platform-specific unit test failures in cc.test-complex-numbers
On Sat, Apr 17, 2010 at 15:45, B Smith-Mannschott wrote: > More oddness: > > If I remove all unit tests *except* test-compex-numbers, all is well: > > [INFO] [clojure:test {execution: test-clojure}] > > Testing clojure.contrib.test-complex-numbers > > Ran 8 tests containing 268 assertions. > 0 failures, 0 errors. Actually, that's not true. The unit tests *usually* run without error, but sometimes crash with a NPE in LazySeq.sval. Here's a script I'm using: [[file: .git/this-build-fails]] #!/bin/bash log=".git/$(date +%F%H%M%S)-$(git log --oneline|head -n 1|cut -d' ' -f1).log" ( mvn clean mvn test ) > $log 2>&1 if grep -q ERROR < $log then echo "build had ERROR: $log" exit 0 else echo "build was OK" rm "$log" exit 1 fi Here's what I told my shell to do, and the resulting output smit...@pepper:~/w/clojure-contrib$ while true ; do .git/this-build-fails ; done build was OK build had ERROR: .git/2010-04-17172643-2bc0dcc.log build had ERROR: .git/2010-04-17172745-2bc0dcc.log build was OK build was OK build was OK build was OK build had ERROR: .git/2010-04-17173302-2bc0dcc.log build was OK build had ERROR: .git/2010-04-17173510-2bc0dcc.log build was OK build was OK build was OK build was OK build had ERROR: .git/2010-04-17174026-2bc0dcc.log build was OK build was OK build was OK build was OK build was OK build was OK build was OK build was OK build was OK The referenced commit 2bc0dcc is one where I've removed all unit tests, save for test_complex_numbers.clj smit...@pepper:~/w/clojure-contrib$ tree src/test/ src/test/ `-- clojure `-- clojure `-- contrib `-- test_complex_numbers.clj The interesting part of the five log files written above always looks this same: a NullPointerException in LazySeq.sval [INFO] [clojure:test {execution: test-clojure}] Testing clojure.contrib.test-complex-numbers Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException (run-test1269169458415140791.clj:0) at clojure.lang.Compiler.eval(Compiler.java:5389) at clojure.lang.Compiler.load(Compiler.java:5784) at clojure.lang.Compiler.loadFile(Compiler.java:5747) at clojure.main$load_script__6226.invoke(main.clj:213) at clojure.main$script_opt__6255.invoke(main.clj:265) at clojure.main$main__6273.doInvoke(main.clj:346) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.lang.Var.invoke(Var.java:365) at clojure.lang.AFn.applyToHelper(AFn.java:165) at clojure.lang.Var.applyTo(Var.java:482) at clojure.main.main(main.java:37) Caused by: java.lang.RuntimeException: java.lang.NullPointerException at clojure.lang.LazySeq.sval(LazySeq.java:47) at clojure.lang.LazySeq.seq(LazySeq.java:56) at clojure.lang.Cons.next(Cons.java:37) Color me confused. Also, this isn't giving me warm fuzzy feelings of confidence for my next Clojure project as I do a lot of my weekend hacking on my netbooks. // 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: Problem with Destructuring in A Function Call
On 16 April 2010 16:25, Asim Jalis wrote: > Could you explain the rationale for this swapping? Intuitively it > seems to me that (let [{ :body x } { :body 42 }] x) should bind x > to 42 -- it seems intuitive because it is binding :body to :body > and 42 to x. My personal take on this is that maps can be thought of as relations -- in the mathematical sense of sets of tuples, where the tuples here are the key/value pairs -- and destructuring a map is analogous to composing two relations. Actually the relations involved here are functions, which is important, but functional composition *is* relational composition in the end (under the usual set-theoretical definition of functions). Perhaps an example will make this clearer: 1. Destructuring pattern: {foo :foo bar :bar} ; => corresponds to a set of tuples: ; #{ [foo, :foo], [bar, :bar] } ; (using Clojure notation rather than the one usual in maths) 2. Map to be destructured: {:foo "foo" :bar "bar"} ; may include other stuff ; => corresponds to a set of tuples: ; #{ [:foo, "foo"], [:bar, "bar"] } 3. Composition of the above: For each element of the domain of the first function -- meaning each key of the first map, the destructuring pattern -- take its corresponding value, feed that to the second function and output the pair [key-from-first-map, value-from-second-map]. With the example data: a. combine [foo :foo] with [:foo "foo"] into [foo "foo"]; b. combine [bar :bar] with [:bar "bar"] into [bar "bar"]; c. dump the above into a map: {foo "foo" bar "bar"}. With this picture in mind, I find Clojure's destructuring patterns perfectly natural. 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: do we have is-delivered? for promise
Hello Per, thats very cool! Many thanks! Completely solves my problem. (As far as I can see :-) I'm not sure whether I completely understand the implications of the nondeterminism you described; will think about it. You say "When each promise can only be written by a single writer.." - I assume you mean this as "Even if ..". Or am I on a wrong track? Background: What I (still) try to do is to implement a blocking lazy list. I'm not sure whether that should be used in the end, but while experimenting with it, I want to print these lists, or, rather, a state of such beast at a certain moment - and so the printer has to stop at the current end of the list, and not block. Thanks again, and kind regards, alux On 17 Apr., 16:46, Per Vognsen wrote: > Not currently. I added the capability to some code I posted last month > for fixing print-method for promises so they aren't auto-dereferenced > when undelivered: > > (defn promise? > [p] > (isa? (type p) ::Promise)) > > (defn promise-delivered? > [p] > (zero? (.getCount (:d p > > (defmethod print-method ::Promise > [writer p] > ((get-method print-method clojure.lang.IDeref) writer p)) > > (defn promise > "Alpha - subject to change. > Returns a promise object that can be read with deref/@, and set, > once only, with deliver. Calls to deref/@ prior to delivery will > block. All subsequent derefs will return the same delivered value > without blocking." > [] > (Promise (java.util.concurrent.CountDownLatch. 1) (atom nil))) > > But there are good reasons for why you might want to discourage this > kind of checking in user code. When each promise can only be written > by a single writer (i.e. there is not a race among several potential > writers to first deliver the promise) then the input-output behavior > of readers is deterministic only if such checking is disallowed. Under > such conditions it doesn't matter if the readers try to dereference > the promise before or after it is ultimately delivered by the writer. > If readers can check the status of the promise, then you can get races > between readers and the writer. > > -Per > > > > On Sat, Apr 17, 2010 at 7:00 PM, alux wrote: > > Hi, > > > is there any nonblocking way I kind find out whether a promise has > > been delivered? > > > Thanky you, alux > > > -- > > 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: do we have is-delivered? for promise
On Sat, Apr 17, 2010 at 11:07 PM, alux wrote: > Hello Per, > > thats very cool! Many thanks! Completely solves my problem. (As far as > I can see :-) > > I'm not sure whether I completely understand the implications of the > nondeterminism you described; will think about it. You say "When each > promise can only be written by a single writer.." - I assume you mean > this as "Even if ..". Or am I on a wrong track? No. The issue I was getting at with that statement is that when a promise is accessible to multiple potential writers there is a race as to who delivers on the promise first. All the runner-ups will fail. Who is the winner and who are the runner-ups is nondeterministic. It should probably be considered a bug in your code if that possibility even exists. In fact, I would argue for separating the capability to write a promise and a read promise, so that you can prevent this from happening accidentally. You can then hand out the reading capability liberally while being more careful with the writing capability. As for the nondeterminism issue with readiness checking: Take the simplest case of a single reader and a single writer. If the reader's only option is to block on the read then it works like Unix pipes: the relative schedule interleaving of the reader and writer is irrelevant to the ultimate outcome. However, if the reader can check to see if the promise is ready (the analogue in the Unix world would be if the reader does a select() on the file descriptor before reading it) then there is at least the potential for a harmful kind of nondeterminism where the outcome changes materially depending on whether the reader or writer wins the race. -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
getting compiler-like meta data from read
I have an application that will read in a large number of structures from a file. those structures will be used throughout the application to produce additional data etc. since they are "user" configurable, it would be nice to know where they come from should one of them start misbehaving. the type of metadata the compiler associates with function definitions etc. would be very valuable. if I'm reading my structures in with (read) is there anyway to get it to attach filename and line-number etc. metadata? for example if I have something like this: (defn read-obj [file] (with-in-reader file (read))) it would be nice if the object returned would be tagged with file- relavent metadata. (this example shows only reading one from the file, but imagine reading many from one file. i know I can just (with-meta) the file name onto the result, but there is lots of other meta data the compiler can already produce, it'd be nice to just grab all that for free) Kevin -- 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: "wrong number of args" with nested map
Thank you all for the explanations. I see now that I wasn't paying close enough attention, and needed to add another pair of brackets to destructure my lambda's single argument. On Apr 16, 11:51 am, Per Vognsen wrote: > Tangent: > > On Fri, Apr 16, 2010 at 7:41 PM, Douglas Philips wrote: > > (1)http://clojure.org/data_structuressays: > > ... seq returns a sequence of map entries, which are key/value pairs. ... > > > I haven't yet found where in the docs a pair is defined, so I am guessing > > that the concrete type (list, vector,...) for a pair is not > > relevant/important. > > That's right. But what is surprising is that when you try to go in the > other direction by converting a sequence of two-element sequences into > a map then the concrete type of those two-element sequences matters a > great deal: > > user> (conj {} [:foo 1]) > {:foo 1} > user> (conj {} (list :foo 1)) > ; Evaluation aborted. > > What's happening is that APersistentMap.cons() has a hard-coded type > check for IPersistentVector. There doesn't seem to be any good for why > it shouldn't work with any ISeq. Maybe performance? If that is a valid > concern, you could retain the current branch for IPersistentVector and > append an else-if for ISeqs. > > This isn't a big problem in practice, though I've been bitten by it > unexpectedly once or twice. But it's a surprising violation of the > principle that one kind of sequence should be as good as any other > when the context calls for no particular performance characteristics > (e.g. O(1) random access). > > -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 > 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
binary structures/bitstrings
Does anyone know of a clojure library for handling (un)packing of binary structures? I'm looking for something similar to perl/ruby/ python's pack(...) function or something like OCaml's bitstring module. My initial google and clojure-contrib perusing hasn't turned up anything obvious though I've found at least one interesting blog post on a related subject. If there is such a thing in existence I'd like to know about it otherwise I'll probably want to create it - to scratch my own itch - and maybe someone else will have an interest in such a thing. -stt -- 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: Dead easy start with Clojure on windows
Found the link here: http://bitbucket.org/kasim/clojurew/get/tip.zip Kasim - thanks for the quick start. Worked fine. Maybe add a readme? M. On Apr 17, 5:35 am, Zmitro Lapcjonak wrote: > On Apr 15, 1:51 am, Kasim wrote: > > > Here are what you need to get started: > > 1. Download ClojureW.zip and Unzip to a folder > > 0. Try to find the link to download. > > -- > Zmitro Lapcionak > > -- > 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: platform-specific unit test failures in cc.test-complex-numbers
On Sat, Apr 17, 2010 at 18:02, B Smith-Mannschott wrote: > On Sat, Apr 17, 2010 at 15:45, B Smith-Mannschott > wrote: >> More oddness: >> >> If I remove all unit tests *except* test-compex-numbers, all is well: >> >> [INFO] [clojure:test {execution: test-clojure}] >> >> Testing clojure.contrib.test-complex-numbers >> >> Ran 8 tests containing 268 assertions. >> 0 failures, 0 errors. > > Actually, that's not true. The unit tests *usually* run > without error, but sometimes crash with a NPE in LazySeq.sval. > > Here's a script I'm using: > > [[file: .git/this-build-fails]] > #!/bin/bash > log=".git/$(date +%F%H%M%S)-$(git log --oneline|head -n 1|cut -d' ' -f1).log" > ( > mvn clean > mvn test > ) > $log 2>&1 > if grep -q ERROR < $log > then > echo "build had ERROR: $log" > exit 0 > else > echo "build was OK" > rm "$log" > exit 1 > fi > > Here's what I told my shell to do, and the resulting output > > smit...@pepper:~/w/clojure-contrib$ while true ; do .git/this-build-fails ; > done > build was OK > build had ERROR: .git/2010-04-17172643-2bc0dcc.log > build had ERROR: .git/2010-04-17172745-2bc0dcc.log > build was OK > build was OK > build was OK > build was OK > build had ERROR: .git/2010-04-17173302-2bc0dcc.log > build was OK > build had ERROR: .git/2010-04-17173510-2bc0dcc.log > build was OK > build was OK > build was OK > build was OK > build had ERROR: .git/2010-04-17174026-2bc0dcc.log > build was OK > build was OK > build was OK > build was OK > build was OK > build was OK > build was OK > build was OK > build was OK > > The referenced commit 2bc0dcc is one where I've removed all unit > tests, save for test_complex_numbers.clj > > smit...@pepper:~/w/clojure-contrib$ tree src/test/ > src/test/ > `-- clojure > `-- clojure > `-- contrib > `-- test_complex_numbers.clj > > The interesting part of the five log files written above always looks > this same: a NullPointerException in LazySeq.sval I'm now seeing unreliable builds of this configuration even on my MacBook (configuration "M"eheadable in the first mail on this thread) which leads me to believe that whatever problem I'm seeing here, it's more widespread than just my two netbooks. 10 of 28 builds failed on the MacBook. All failures produced the same stack trace (though this one is somewhat different than what I saw on my netbook, described in the previous mail.) Testing clojure.contrib.test-complex-numbers Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException (run-test1151698185522980091.clj:0) at clojure.lang.Compiler.eval(Compiler.java:5389) at clojure.lang.Compiler.load(Compiler.java:5784) at clojure.lang.Compiler.loadFile(Compiler.java:5747) at clojure.main$load_script__6226.invoke(main.clj:213) at clojure.main$script_opt__6255.invoke(main.clj:265) at clojure.main$main__6273.doInvoke(main.clj:346) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.lang.Var.invoke(Var.java:365) at clojure.lang.AFn.applyToHelper(AFn.java:165) at clojure.lang.Var.applyTo(Var.java:482) at clojure.main.main(main.java:37) Caused by: java.lang.RuntimeException: java.lang.NullPointerException at clojure.lang.LazySeq.sval(LazySeq.java:47) at clojure.lang.LazySeq.seq(LazySeq.java:56) at clojure.lang.Cons.next(Cons.java:37) at clojure.lang.RT.boundedLength(RT.java:1162) at clojure.lang.RestFn.applyTo(RestFn.java:131) at clojure.core$apply__3643.invoke(core.clj:480) at clojure.test$run_tests__6820.doInvoke(test.clj:691) at clojure.lang.RestFn.invoke(RestFn.java:409) at user$eval__1507$fn__1510.invoke(run-test1151698185522980091.clj:9) at user$eval__1507.invoke(run-test1151698185522980091.clj:7) at clojure.lang.Compiler.eval(Compiler.java:5373) ... 10 more Caused by: java.lang.NullPointerException at clojure.core.protocols$fn__6000$G__5996__6004.invoke(protocols.clj:11) at clojure.core$reduce__6111.invoke(core.clj:4719) at clojure.test$join_fixtures__6796.invoke(test.clj:629) at clojure.test$test_all_vars__6803.invoke(test.clj:653) at clojure.test$test_ns__6817.invoke(test.clj:677) at clojure.core$map__4086$fn__4087.invoke(core.clj:1870) at clojure.lang.LazySeq.sval(LazySeq.java:42) ... 20 more I notice that clojure.core.protocols makes a showing here, which is consistent with the first message in this thread. I also know that protocols are still under development. Judging from the randomness of the observed brokenness I'd wager that there's a race condition of some sort buried in protocols or in the abstractions it builds upon. any better guesses? // 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 post
Re: getting compiler-like meta data from read
On Sat, Apr 17, 2010 at 2:29 AM, Kevin Livingston wrote: > I have an application that will read in a large number of structures > from a file. those structures will be used throughout the application > to produce additional data etc. since they are "user" configurable, > it would be nice to know where they come from should one of them start > misbehaving. the type of metadata the compiler associates with > function definitions etc. would be very valuable. if I'm reading my > structures in with (read) is there anyway to get it to attach filename > and line-number etc. metadata? The reader doesn't do that but you can easily do it yourself if you only want to annotate top-level values. Thinking about this made me realize that it would be nice if the reader reentered itself (as it does in LispReader's readDelimitedList() and a few other contexts) through a var so it could be rebound by a programmer. Then you could inject your own line number annotation into the reader which would apply not only to top-level values (e.g. a vector literal) but also its subvalues (e.g. the elements of the vector literal). -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: platform-specific unit test failures in cc.test-complex-numbers
I let Meheadable and George (my two macs) run clojure-contrib builds while I was watching TV to get an idea of the probability of this crash occurring was. George, a 1 GHz PowerPC G4 (1 core) fails 37 of 59 builds (circa 63%) Meheadable, a 2.2 GHz Core2Duo (2 cores) fails 48 of 132 builds (circa 36%) It seems clear now that the problem is Clojure not clojure-contrib, so I'm going to try to do a bisection of Clojure and see if I can't figure out when this problem first cropped up. // 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: platform-specific unit test failures in cc.test-complex-numbers
It's almost certainly the commit that added the InternalReduce protocol: 5b281880571573c5917781de932ce4789f18daec. I am slowly pounding my skull against this and would welcome any help. It appears that the internal-reduce function flakes out and stops working, but only intermittently. If there is some way that protocols.clj gets *re*loaded while Clojure is running, that would definitely be a problem, as reduce depends on it. I let Meheadable and George (my two macs) run clojure-contrib builds while I was watching TV to get an idea of the probability of this crash occurring was. George, a 1 GHz PowerPC G4 (1 core) fails 37 of 59 builds (circa 63%) Meheadable, a 2.2 GHz Core2Duo (2 cores) fails 48 of 132 builds (circa 36%) It seems clear now that the problem is Clojure not clojure-contrib, so I'm going to try to do a bisection of Clojure and see if I can't figure out when this problem first cropped up. // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: platform-specific unit test failures in cc.test-complex-numbers
On Sat, Apr 17, 2010 at 21:32, Stuart Halloway wrote: > It's almost certainly the commit that added the InternalReduce protocol: > 5b281880571573c5917781de932ce4789f18daec. > > I am slowly pounding my skull against this and would welcome any help. It > appears that the internal-reduce function flakes out and stops working, but > only intermittently. > > If there is some way that protocols.clj gets *re*loaded while Clojure is > running, that would definitely be a problem, as reduce depends on it. > Yes, I just saw a8e92018ce0ce32fc59fae2072369a8671fdea62 "disable new reduce" go in on clojure/master and have been running repeated builds of clojure-contrib builds using that. It's a marked improvement, I'm now only seeing 1 build of every 18 fail. It's no longer failing in complex-numbers but rather in json: ERROR in (can-print-json-null) (run-test1309997463507545582.clj:44) expected: (= "null" (json-str nil)) actual: java.lang.NullPointerException: null at clojure.contrib.json$eval__7586$fn__7587$G__7578__7590.invoke (json.clj:204) clojure.contrib.json/json_str (json.clj:306) clojure.contrib.test_json/fn (test_json.clj:148) clojure.test$test_var__6804$fn__6805.invoke (test.clj:644) clojure.test/test_var (test.clj:644) clojure.test$test_all_vars__6809$fn__6810$fn__6817.invoke (test.clj:659) clojure.test/default_fixture (test.clj:617) clojure.test$test_all_vars__6809$fn__6810.invoke (test.clj:659) clojure.test/default_fixture (test.clj:617) clojure.test/test_all_vars (test.clj:655) clojure.test/test_ns (test.clj:677) clojure.core$map__4089$fn__4090.invoke (core.clj:1870) clojure.lang.LazySeq.sval (LazySeq.java:42) clojure.lang.LazySeq.seq (LazySeq.java:56) clojure.lang.Cons.next (Cons.java:37) clojure.lang.RT.next (RT.java:540) clojure.core/next (core.clj:54) clojure.core/reduce (core.clj:707) clojure.core/reduce (core.clj:698) clojure.core$merge_with__4179.doInvoke (core.clj:2046) clojure.lang.RestFn.applyTo (RestFn.java:140) clojure.core/apply (core.clj:480) clojure.test$run_tests__6826.doInvoke (test.clj:691) clojure.lang.RestFn.invoke (RestFn.java:1261) user$eval__12082$fn__12085.invoke (run-test1309997463507545582.clj:46) user/eval (run-test1309997463507545582.clj:44) clojure.lang.Compiler.eval (Compiler.java:5373) clojure.lang.Compiler.load (Compiler.java:5784) clojure.lang.Compiler.loadFile (Compiler.java:5747) clojure.main/load_script (main.clj:213) clojure.main/script_opt (main.clj:265) clojure.main$main__6279.doInvoke (main.clj:346) clojure.lang.RestFn.invoke (RestFn.java:409) clojure.lang.Var.invoke (Var.java:365) clojure.lang.AFn.applyToHelper (AFn.java:165) clojure.lang.Var.applyTo (Var.java:482) clojure.main.main (main.java:37) Line 204 of json.cl is: 202 ;;; JSON PRINTER 203 *204 (defprotocol Write-JSON 205 (write-json [object out] 206 "Print object to PrintWriter out as JSON")) So, though a8e92018 is a great improvement, I'm still seeing some defprotocol related misbehavior. // 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
Has deftype changed?
I am seeing compilation errors in my code with deftype. I just updated my project dependencies and probably pulled in the latest clojure package. Anyway, the following code from wiki doesn't work anymore. Pointers to any late breaking changes much appreciated! TIA (deftype Bar [a b c d e]) (def b (Bar 1 2 3 4 5)) Expecting var, but Bar is mapped to class package.Bar [Thrown class java.lang.Exception] Restarts: 0: [ABORT] Return to SLIME's top level. Backtrace: 0: clojure.lang.Compiler.lookupVar(Compiler.java:5677) 1: clojure.lang.Compiler.isMacro(Compiler.java:5178) 2: clojure.lang.Compiler.macroexpand1(Compiler.java:5233) 3: clojure.lang.Compiler.analyzeSeq(Compiler.java:5305) 4: clojure.lang.Compiler.analyze(Compiler.java:5140) 5: clojure.lang.Compiler.access$100(Compiler.java:35) 6: clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:417) 7: clojure.lang.Compiler.analyzeSeq(Compiler.java:5319) 8: clojure.lang.Compiler.analyze(Compiler.java:5140) 9: clojure.lang.Compiler.analyze(Compiler.java:5101) 10: clojure.lang.Compiler.eval(Compiler.java:5377) 11: -- 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: Has deftype changed?
(deftype Bar [a b c d e]) (def b (new Bar 1 2 3 4 5)) There are a few other syntax changes too, defrecord replaces extending IPersistenMap, and you need to include 'this' in protocol fun implementations ... http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/deftype http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defrecord On Apr 17, 4:37 pm, Praki wrote: > I am seeing compilation errors in my code with deftype. I just updated > my project dependencies and probably pulled in the latest clojure > package. Anyway, the following code from wiki doesn't work anymore. > Pointers to any late breaking changes much appreciated! > > TIA > > (deftype Bar [a b c d e]) > (def b (Bar 1 2 3 4 5)) > > Expecting var, but Bar is mapped to class package.Bar > [Thrown class java.lang.Exception] > > Restarts: > 0: [ABORT] Return to SLIME's top level. > > Backtrace: > 0: clojure.lang.Compiler.lookupVar(Compiler.java:5677) > 1: clojure.lang.Compiler.isMacro(Compiler.java:5178) > 2: clojure.lang.Compiler.macroexpand1(Compiler.java:5233) > 3: clojure.lang.Compiler.analyzeSeq(Compiler.java:5305) > 4: clojure.lang.Compiler.analyze(Compiler.java:5140) > 5: clojure.lang.Compiler.access$100(Compiler.java:35) > 6: clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:417) > 7: clojure.lang.Compiler.analyzeSeq(Compiler.java:5319) > 8: clojure.lang.Compiler.analyze(Compiler.java:5140) > 9: clojure.lang.Compiler.analyze(Compiler.java:5101) > 10: clojure.lang.Compiler.eval(Compiler.java:5377) > 11: > > -- > 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: Erlang like environment
I have used blitz javaspaces quite a bit, but not yet with clojure. I believe they would we be a good fit. Javaspaces are a dynamic, flexible, by-value, distributed coordination mechanism. On Apr 14, 5:42 pm, gary ng wrote: > Hi, > > I just start to learn about clojure and is wondering if there is any erlang > like environment for clojure ? By that, I mean not just the messaging > passing(which as far as I can tell for clojure is within the same process) > but its live update and sending symbols(and as far as I know functions as > well) across process/vm instances(which can be on the same machine or > another machine within a private network). -- 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
Embedding swank-clojure
Based on the Embedding section of http://github.com/technomancy/swank-clojure, I'm using the following to test it out. Is there a better way to do this that doesn't use Compiler? Is there a way to programmatically stop swank? It seems start-repl takes control of the thread. What would be a good way to spawn off another thread for it and be able to kill that thread programatically. import clojure.lang.Compiler; import java.io.StringReader; public class Embed { public static void main(String[] args) throws Exception { final String startSwankScript = "(ns my-app\n" + " (:use [swank.swank :as swank]))\n" + "(swank/start-repl) "; Compiler.load(new StringReader(startSwankScript)); } } Any help much appreciated, hhh -- 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