Aw: Re: Prisoner's Dilemma in Clojure

2011-08-22 Thread Stefan Kamphausen
Hi, Am Montag, 22. August 2011 16:08:20 UTC+2 schrieb lpetit: > > 2011/8/22 Dave Ray > >> I'm not sure why this code was written this way, but Marginalia has no >> problem using docstrings. Compare it's own docs: >> [...] > > ok, thanks Dave > that Marginalia also understands docstrings notwith

Re: Why do transactions block each other?

2011-08-29 Thread Stefan Kamphausen
Hi, the commute case can be understood: user=> (send thread (fn [agt aref] (dosync (commute aref + 100) (Thread/sleep 8000) agt)) account) # user=> (time (dosync (ref-set account 2000))) "Elapsed time: 0.369415 msecs" 2000 user=> @account 2000 ;; wait a few seconds user=> @account 2100 So, the

Re: Why do transactions block each other?

2011-08-29 Thread Stefan Kamphausen
The call to alter already wrote to the Ref, this requires a write-lock on the ref (see LockingTransaction.java/doSet). After that it sleeps a while and gets to its commit phase. The other transactions retries in the meantime. Consider the following code, which introduces some atoms for count

Re: Why do transactions block each other?

2011-08-29 Thread Stefan Kamphausen
Hm, while I was just reading the source of the STM implementation in Ref.java and LockingTransaction.java two new questions came up for me. 1. Is there any use of the msecs field in the inner TVal in Ref? I don't see any and if it's not used anymore, at least two calls to System.currentTimeMil

Minor Speedup of STM removing milliseconds [Was: Why do transactions block each other?]

2011-08-30 Thread Stefan Kamphausen
Hi, using a current git checkout of master (git describe says 'clojure-1.3.0-beta2-2-g0689c47') I ran the test-code from http://clojure.org/refs like this: (time (run 100 10 10 100)) "Elapsed time: 18413.314789 msecs" Actually I ran that code several times until I would see no improvement

Re: Why do transactions block each other?

2011-09-05 Thread Stefan Kamphausen
Hi, there is another paper in the wild which very nicely describes, how Clojure's implementation of STM works and how it compares to other management strategies for resolving conflicts. http://vbn.aau.dk/files/32587755/report.pdf Definitely worth a read, I think. Best, Stefan -- You receiv

Re: An open call to the community: Let's prepare for 1.3

2011-09-05 Thread Stefan Kamphausen
Hi Chris, could you please elaborate a bit on the swank-clojure issue? Alternatively just point me to the threads that I should have read more closely. Thanks and kind regards, Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Stefan Kamphausen
hi, > why does clojure want to cast the result to IFn? > if I parse that correctly, you have two parens around the let-expression. That leads to Clojure evaluating the let-expression, taking the result (which is the return value of the line you mentioned: a Boolean) and trying to call that as

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Stefan Kamphausen
Hi, On Tuesday, September 6, 2011 3:35:08 PM UTC+2, HamsterofDeath wrote: > > > (every? (= parameter player) currow > i'd like to write something like: > > do i have to define the function via letfn before, or is there a way > to do it nested in the code? > you can create a function anytime using

Re: defrecord == premature optimization?

2011-09-07 Thread Stefan Kamphausen
Hi, a little off-topic ... On Wednesday, September 7, 2011 1:12:05 AM UTC+2, stuart@gmail.com wrote: > > This is by design. Function position indicates that the data structure is a > collection, not a (logical) record. > AFAIK there a lots of well designed things in Clojure which reflect d

Re: defrecord == premature optimization?

2011-09-07 Thread Stefan Kamphausen
Hi, On Wednesday, September 7, 2011 3:02:00 PM UTC+2, Meikel Brandmeyer (kotarak) wrote: > > Hi, > > Am Mittwoch, 7. September 2011 14:05:57 UTC+2 schrieb Stefan Kamphausen: >> >> the explanation why speed is the default and not safety (if I may >> summarize th

Re: Aw: Re: defrecord == premature optimization?

2011-09-07 Thread Stefan Kamphausen
Hi, yeah, maybe I should have chosen my words more wisely. I think it comes from my CL background where you can (declare (optimize (speed 3) (safety 0)) to achieve this behavior. Not to be nitpicking here. An Exception is obviously 'safer' than a silent truncation and then the decision betwe

Trivial patch for (sometimes) faster STM

2011-09-09 Thread Stefan Kamphausen
TL;DR: There is small patch which improves speed of STM Hi, in the light of the upcoming 1.3 you might be interested in a rather trivial patch which can lead to significant speedup of STM processing. 1. Background I was studying the implementation of STM for a talk at this year's SourceTalk [

Re: Trivial patch for (sometimes) faster STM

2011-09-09 Thread Stefan Kamphausen
FWIW I just could run the test-suite on a quad-core VMWare which lead to 12-15% speed-up. (No detailed report available) -- 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 fro

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Maybe the example becomes clearer with a little less foo and a little more bar and baz: shell> lein repl REPL started; server listening on localhost port 64913 user=> (defn foo [arg] "foo") #'user/foo user=> (defn bar->baz [a b] "bar->baz") #'user/bar->baz user=> (foo (bar->baz "a")) java.lang.Il

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Hi, On Monday, September 12, 2011 8:07:22 PM UTC+2, Chouser wrote: > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L436 > looks like a subtle bug, doesn't it? The compiler translates '-' to '_' (Compiler.java:2619) and '>' to '_GT_' (Compiler.java:2623). Toge

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Just some more, maybe even simpler examples: Clojure 1.3.0-master-SNAPSHOT user=> (defn foo>>bar [] "") user=> (foo>>bar "a") ArityException Wrong number of args (1) passed to: user$foo-GT clojure.lang.AFn.throwArity (AFn.java:439) user=> (defn foo++bar [a] "") user=> (foo++bar) ArityException

Re: puzzlement over lazy sequences

2011-09-13 Thread Stefan Kamphausen
Hi, On Tuesday, September 13, 2011 6:28:01 AM UTC+2, Ken Wesson wrote: > > > They're trees of arrays of 32 items, and the trees can in principle > have arbitrary depth. So the 2^31 limit on Java arrays doesn't impact > the Clojure collections, it seems. > are you sure? As far as I understood thi

Re: Rounding the edges of an Emacs beginner

2011-09-14 Thread Stefan Kamphausen
Hi, just a few follow-ups... On Wednesday, September 14, 2011 4:13:47 AM UTC+2, frye wrote: - ? howto list modes engaged Aside from the already mentioned C-h m (aka M-x describe-mode) you will want to use * C-h k (M-x describe-key) followed by some keybinding to find out what that keybi

Re: Rounding the edges of an Emacs beginner

2011-09-15 Thread Stefan Kamphausen
Hi, we're getting totally OT here and should probably better head for gnu.emacs.help. Anyway, just one more bark from me and then I'll be quiet (but will respond to mail ;-) On Thursday, September 15, 2011 2:08:28 AM UTC+2, frye wrote: > > In Vim , you press *Ctrl-d* and *Ctrl-u* to go down an

Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread Stefan Kamphausen
Hi, is there any particular reason not to use a Set instead of a vector? It solves the issue of distinct values. Or am I missing something? Regards, Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: Why visible in-transaction changes?

2011-09-23 Thread Stefan Kamphausen
Hi, On Friday, September 23, 2011 5:25:34 PM UTC+2, stuart@gmail.com wrote: > > I would have hoped that changes to refs during an transaction wouldn't > affect the in-transaction value of the ref > > you usually don't want that. When you start working on more than one value in a transaction

Re: beginner question

2011-09-25 Thread Stefan Kamphausen
Hi, regarding the writing of a game in Clojure, I think http://codethat.wordpress.com/2011/09/10/writing-tetris-in-clojure/ is a good post to read. Regards, Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Problem Running ClojureScript on OpenJDK

2011-10-02 Thread Stefan Kamphausen
Hi, I hope, people are aware that Oracle considers OpenJDK to be the standard choice for Linux users now and removed the special distributor's license. See http://robilad.livejournal.com/90792.html Kind regards, Stefan -- You received this message because you are subscribed to the Google Gr

Re: Macro tutorials?

2011-10-06 Thread Stefan Kamphausen
Hi. You might consider reading Peter Seibel's excellent Practical Common Lisp which has some nice macro-work in it. If after that you're still hungry for more, consider Let Over Lambda by Doug Hoyte. Admitted, both cover Common Lisp, but the differences will not keep you from getting a deepe

Re: Exception handling changes in Clojure 1.3.0

2011-10-12 Thread Stefan Kamphausen
Hi, To my humble ears this sounds like the best idea so far. Something like ClojureRTException ... Regards, Stefan -- 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 n

Re: Exception handling changes in Clojure 1.3.0

2011-10-12 Thread Stefan Kamphausen
Just for the record: That's how I understood Ivan's idea, too. Introduce a special exception type which is used nowhere else and unwrap that automatically. I am not experienced enough a Java programmer to know all the implications that may arise here and there. Regards, Stefan -- You receiv

Re: Potential bug: pmap vs chunked seqs

2011-10-21 Thread Stefan Kamphausen
Why do you think, there is a bug? You are referring to the /code/, i.e. the implementation, of things, which is not a defined interface. At the same time, the /documentation/ describes the actual behavior quite well. Chunked seqs are supposed to realize more elements than you consume. That's f

Re: Literate programming

2011-10-28 Thread Stefan Kamphausen
Hi, just to be sure: are you are aware of Marginalia? https://github.com/fogus/marginalia Regards, Stefan -- 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

Re: Literate programming

2011-10-28 Thread Stefan Kamphausen
Clojure moved off the local optimum of common lisp > I can't help, but I really like that quote. Nice meme :-) Stefan -- 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 f

Re: -> vs ->> and names vs anonymous function

2011-11-02 Thread Stefan Kamphausen
Hi, while all the other answers already offered explanations and solutions I feel like I should add, that macros like -> and ->> work on the source-code. So using -> does not mean 'pass the first thing as an argument to the function call in the second thing', it means 'take the first thing an

Re: -> vs ->> and names vs anonymous function

2011-11-04 Thread Stefan Kamphausen
Thanks for pointing my error out. I was not only oversimplifying things, worse, I simplified something away that was crucial to the original question. Regards Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: A few enhancements

2011-12-02 Thread Stefan Kamphausen
On Thursday, December 1, 2011 8:23:33 PM UTC+1, Alan Malloy wrote: > > 1) I agree this seems silly but I don't think it's ever bitten me Ain't this the difference between a language, that's been around for QAW (Quite A While, maybe even long enough to become a standard, e.g. ANSI) and a newco

Re: FYI: problem I had with namespace, defrecord, and import, or "Hyphen characters in namespaces considered harmful"

2011-12-02 Thread Stefan Kamphausen
Hi, to be honest I'd rather not see any magic behavior of the importing mechanism. Better to fail early, but with a suitable error message, no? Cheers, Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: What is the different between = and identical ?

2011-12-02 Thread Stefan Kamphausen
On Friday, December 2, 2011 8:44:07 AM UTC+1, Tassilo Horn wrote > > JVM does some sort of pooling. It seems there's exactly one Long for > any long value in the range [-128...127], but you shouldn't rely on > that. > And I always thought it was 1024, but user=> (identical? 127 127) true use

Re: Codox: an API doc generator for Clojure

2011-12-27 Thread Stefan Kamphausen
Hi, On Tuesday, December 27, 2011 1:18:52 PM UTC+1, James Reeves wrote: > > It might be an idea to figure out some standard syntax we could use, > like Markdown, that could be used for formatting docstrings. > IMHO the missing homoiconicity of docstrings in all flavors of Lisp that I worked with

Re: Best IDE

2012-01-23 Thread Stefan Kamphausen
Hi, On Friday, January 20, 2012 9:40:53 AM UTC+1, Norman Gray wrote: > > Thus C-M-(, C-M-), C-M-f, -b, -u, -d and -k do most of what one wants, in > terms of creating and moving around balanced brackets. why did nobody mention C-M-Space, yet? To me it's one of the most important keystrokes ac

Re: Best IDE

2012-01-23 Thread Stefan Kamphausen
Hi, On Monday, January 23, 2012 1:27:51 PM UTC+1, lpetit wrote: > > 2012/1/23 Stefan Kamphausen > >> Hi, >> >> >> On Friday, January 20, 2012 9:40:53 AM UTC+1, Norman Gray wrote: >>> >>> Thus C-M-(, C-M-), C-M-f, -b, -u, -d and -k do most of w

Re: Being "not Lisp" is a feature?

2010-11-09 Thread Stefan Kamphausen
On Nov 9, 6:08 pm, David Sletten wrote: > I don't want to start any language wars, but this is > funny:http://gosu-lang.org/comparison.shtml Yeah, I had a good laugh this morning. ;-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Library and development process for GAE

2011-01-09 Thread Stefan Kamphausen
Hi, finally I find some time to dive into the development with Clojure for Googles AppEngine. My first question is: which library should a newcomer use, appengine[1] or appengine-magic[2]? Or can you give me some hints in which way they differ? They both seem to be actively developed. And h

Re: Library and development process for GAE

2011-01-09 Thread Stefan Kamphausen
Hi, On Sunday, January 9, 2011 6:37:58 PM UTC+1, Constantine Vetoshev wrote: > > > I'm the author of appengine-magic, so my opinion is necessarily biased > in its favor. :) > fine with me. The authors are most likely to be the ones to be able to tell the differences. :-) > I optimized the

Re: Metadata on symbols differ with caret reader

2011-01-10 Thread Stefan Kamphausen
Hi, I can't verify that a REPL created by lein behaves differently. Did you perhaps update an old project.el without running lein deps? In addition to that: your defproject has too many ]'s Regards, Stefan -- You received this message because you are subscribed to the Google Groups "Clojur

Re: Enhanced Primitive Support Syntax

2011-01-15 Thread Stefan Kamphausen
Hi, just for the record: from what I have done in the past I wholeheartedly agree with Bob. Of course the developers of Clojure have the final say on this. It's just my 2ct. Kind regards, Stefan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Request for review: GAHelloWorld

2011-02-13 Thread Stefan Kamphausen
Hi, you may be interested in reading the code from our book which a) includes the code for doing exactly what you did (evolve a string) and b) shows how multithreading can change your way of doing GAs (get rid of the concept of generations). The book and the code are written in German which ma

<    1   2   3