Re: DISCUSS: replace (rand)

2008-12-04 Thread don.aman
Since we're being all high-level, it'd be good for a random function which allows us to specify the range of numbers, since % doesn't promise an even spread of probabilities (especially for large ranges). --~--~-~--~~~---~--~~ You received this message because you

Re: PATCH for clojure.contrib.javadoc: use any local/remote javadocs

2008-12-04 Thread Christophe Grand
Hi Stuart, That's very neat! Thanks! I'll apply your patch but I don't want to require java 6 since there's the swing fallback for java 5: I'll keep the refelector-based open-url-in-browser. Christophe On Wed, Dec 3, 2008 at 7:28 PM, Stuart Sierra [EMAIL PROTECTED]wrote: Hi Christophe, hi

Munich Lisp User Group, SLIME and Swank-clojure backend

2008-12-04 Thread Geoffrey Teale
I was at the Munich LISP User Group meeting last night. We had a presentation from Tobias C. Rittweiler. Although it was mostly Common Lisp focused (and SBCL at that), it was very interesting. Tobias said he will put the detailed slides up on http://planet.lisp.org for anyone who is

Re: Clojure indentation conventions

2008-12-04 Thread Christian Vest Hansen
On Thu, Dec 4, 2008 at 8:09 AM, mac [EMAIL PROTECTED] wrote: I am partial to a guideline for number of lines in a function because that has a lot to do with program factoring, not just aesthetics. But 80 characters for a line is a bit drastic. Sure it prints well on paper but who prints code

Re: More Monads

2008-12-04 Thread Konrad Hinsen
On 02.12.2008, at 18:49, jim wrote: One thing I saw is that 'replace-syms' could be simplified. I rewrote it as: (defn- replace-syms [sym-map expr] (cond (seq? expr) (map #(replace-syms sym-map %) expr) (coll? expr) (into (empty expr)

Surprise effect

2008-12-04 Thread Konrad Hinsen
A typo made me discover a behaviour of Clojure for which I haven't found an explanation yet: user= (def a 2) #'user/a user= a 2 user= a' 2 user= a a user= a' 2 user= (+ a 1) (+ a 1) What does a' do to the symbol a to make it behave differently? Konrad.

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-04 Thread Meikel Brandmeyer
Hello Rich, On 4 Dez., 02:30, Rich Hickey [EMAIL PROTECTED] wrote: needle is a strange name - what's the origin? expr is probably better. I thought of it as needle, which we search in the haystack. But this comparison is not very good after a second thought. Changed needle to expr. I think

Re: Surprise effect

2008-12-04 Thread Meikel Brandmeyer
Hi, On 4 Dez., 10:08, Konrad Hinsen [EMAIL PROTECTED] wrote: user= a' 2 user= a a a' is parsed as: a = symbol = evaluate = 2 = print prompt ' = reader macro = wait for more Then you type the second a and it goes on: a = translate 'a = (quote a) = a = print prompt So reader is actually in

Re: Surprise effect

2008-12-04 Thread Ralf Bensmann
Just thought the same... But when I use quoting there is always a whitespace before the quote to seperate it from the preceding text. Is this a misleading behavior of the reader, or a feature? ;) -Ralf On Thu, Dec 4, 2008 at 10:50 AM, Meikel Brandmeyer [EMAIL PROTECTED] wrote: Hi, On 4 Dez.,

Re: Surprise effect

2008-12-04 Thread Konrad Hinsen
On Dec 4, 2008, at 10:50, Meikel Brandmeyer wrote: On 4 Dez., 10:08, Konrad Hinsen [EMAIL PROTECTED] wrote: user= a' 2 user= a a a' is parsed as: a = symbol = evaluate = 2 = print prompt ' = reader macro = wait for more Then you type the second a and it goes on: a = translate 'a =

Re: License of/permission for Clojure's logo

2008-12-04 Thread Rich Hickey
On Dec 3, 11:30 pm, samppi [EMAIL PROTECTED] wrote: I want to put the Clojure logo:http://clojure.googlegroups.com/web/Clojure-logo.png?gda=y8lqvUIAAABo... ...on Wikipedia's article on Clojure. What is the license of Clojure's logo--is it a free image? Or can Mr. Hickley give me

Re: Bug (I think): Can't sort collection of vectors containing big integers

2008-12-04 Thread Rich Hickey
On Dec 4, 2:32 am, puzzler [EMAIL PROTECTED] wrote: OK, after my last goof-up in reporting a bug, I'm reluctant to state with certainty that this is a bug, but it sure seems that way: This works: (sort [[5 2] [1 0] [3 4]]) This works: (sort [3243214324324132413243243243243243243234

Re: Improved Maven Build

2008-12-04 Thread verec
+1 (avoid Maven, drop pom) I'm just out of a project that has used Maven for more than 18 month. The pain and frustration caused by the slowness and compexity of Maven's download the whole internet approach can be matched only bu the willingness of team astronauts to introduce Maven plugins in

Re: mutability

2008-12-04 Thread Timothy Pratley
I've finished my MUD - 240 lines including blanks and comments http://clojure.googlegroups.com/web/funmud.clj http://clojure.googlegroups.com/web/funmud.PNG Obviously it is in no way comparable as mine is a PvP whereas the OP was a single player (not really a Multi User Dungeon you know!).

Re: delimited continuations for web development

2008-12-04 Thread Rich Hickey
On Dec 2, 12:52 pm, Jan Rychter [EMAIL PROTECTED] wrote: Rich Hickey [EMAIL PROTECTED] writes: On Jun 20, 11:58 am, Jaime Barciela [EMAIL PROTECTED] wrote: Hello Phil, My understanding is that Common Lisp doesn't have support for continuations either and that's why Weblocks uses

Re: delimited continuations for web development

2008-12-04 Thread Michael Reid
with a delimited continuation, you're capturing it from the outside, so you don't have that problem. Yeah I'm pretty sure its possible. I've been intrigued by this continuations based web programming trend as well. Early on when I learned of Clojure I made a very poor attempt to port cl-cont

Clojure Contrib's build.xml

2008-12-04 Thread Randall R Schulz
Hi, This morning after I svn up -ed Clojure Contrib, I could no longer build. It turns out that was 'cause I was still using Ant 1.6.2. But I looked at the line about which the old Ant complained, and it is: path location=CPL.txt/ However, the name of the file in the SVN repository is

Re: Clojure template library

2008-12-04 Thread Randall R Schulz
On Thursday 04 December 2008 06:04, Rich Hickey wrote: ... StringTemplate http://www.stringtemplate.org/ StringTemplate, by the way, is how ANTLR generates its parser code (ANTLR is target-language-neutral, not Java-specific). ... Rich Randall Schulz

Re: Clojure template library

2008-12-04 Thread Stuart Sierra
On Dec 4, 9:04 am, Rich Hickey [EMAIL PROTECTED] wrote: StringTemplate http://www.stringtemplate.org/ StringTemplate looks cool -- a functional, context-free template language, with a less annoying syntax than either ERB or Google XML Pages. From the author: Just so you know, I've never been a

Re: Clojure template library

2008-12-04 Thread .Bill Smith
StringTemplate http://www.stringtemplate.org/ In StringTemplate's case, the design was more than a stylistic issue; the author wanted a specific kind of separation between the template and the business logic. He wrote a short paper on the subject (see his website for details), which is worth

Re: Clojure template library

2008-12-04 Thread ppierre
A nice solution is PURE : http://beebole.com/pure/ JavaScript templating engine converting Json to HTML. With a Clojure version you have identical code for HTML and AJAX : Server side : Clojure/PURE + HTML - HTML Client side : Clojure/JSON - JavaScript/PURE + AJAX pierre

Re: Clojure Contrib's build.xml

2008-12-04 Thread walterc
and the property clojure.jar should be defined somewhere for the library files to compile. On Dec 4, 11:05 pm, Stuart Sierra [EMAIL PROTECTED] wrote: I just pushed a fix. -Stuart Sierra On Dec 4, 9:33 am, Randall R Schulz [EMAIL PROTECTED] wrote: Hi, This morning after I svn up -ed

Re: Clojure Contrib's build.xml

2008-12-04 Thread Meikel Brandmeyer
Hello, On 4 Dez., 16:51, walterc [EMAIL PROTECTED] wrote: and the property clojure.jar should be defined somewhere for the library files to compile. It's not a bug, it's a feature. In case the property is not defined, they sources are only jar'd. To compile the files specify the property with

Re: Extending Clojure's STM with external transactions

2008-12-04 Thread Razvan Ludvig
Hi Dave. I think your proposal would be useful to have in Clojure, I have thought about something similar since I read about the STM. But I also think there are quite a few difficulties in implementing this in a sane way. Actually, the more I think about it, the more it seems that the goal of STM

Re: Surprise effect

2008-12-04 Thread Dan Larkin
For what it's worth SBCL has this same behavior (although I don't like it). On Dec 4, 2008, at 5:45 AM, Konrad Hinsen wrote: On Dec 4, 2008, at 10:50, Meikel Brandmeyer wrote: On 4 Dez., 10:08, Konrad Hinsen [EMAIL PROTECTED] wrote: user= a' 2 user= a a a' is parsed as: a = symbol

Re: License of/permission for Clojure's logo

2008-12-04 Thread samppi
Ah ha ha ha. Wow, my mistake. I'll make sure to spell it correctly. I totally agree with cogfun, though—it's a really nice logo. Did you make it yourself? On Dec 4, 5:23 am, Rich Hickey [EMAIL PROTECTED] wrote: On Dec 3, 11:30 pm, samppi [EMAIL PROTECTED] wrote: I want to put the Clojure

Re: Clojure template library

2008-12-04 Thread blackdog
You can find a little demo I put together for lauofdk here: http://www.ipowerhouse.com/lau.zip It is exactly what ppierre mentioned, clojure servlets returning json with a jquery/pure client hello world. the dl includes jetty, and can be fired up with ./run test.clj test.clj configures

Re: Bug (I think): Can't sort collection of vectors containing big integers

2008-12-04 Thread harrison clarke
the same issue is there for sorted-map and sorted-set. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send

Re: (doc)strings after param in defn

2008-12-04 Thread Mon Key
The part after the argument vector goes into the function body, which is wrapped in a do. do evaluates the expressions and returns the value of the last one. The results of evaluating the other expressions are discarded. Ok. That provides the clarity I was after. Thank You. It looks like

PATCH: fixed issue in doPrepared

2008-12-04 Thread Tom Emerson
Here is a patch that appears to fix the issue I found in the sql library's doPrepared function, which I mentioned earlier. -- Tom Emerson [EMAIL PROTECTED] http://www.dreamersrealm.net/~tree --~--~-~--~~~---~--~~ You received this message because you are

Re: Unary Application of (= ...)

2008-12-04 Thread Scott Fleckenstein
I'm a newbie, so feel free to bash me on the noggin if i'm missing something: Personally, I would love = to support null-ary case; being able to use apply with = seems very powerful, and would remove the need to check for an empty sequence. -Scott On Dec 3, 9:39 pm, Krukow [EMAIL PROTECTED]

Re: PATCH: fixed issue in doPrepared

2008-12-04 Thread Stephen C. Gilardi
Hi Tom, Thanks for the report. I had made an accidental checkin at svn258. I've reverted to code identical to svn257 which I believe is correct. Please give it a try. --Steve On Dec 4, 2008, at 2:08 PM, Tom Emerson [EMAIL PROTECTED] wrote: Here is a patch that appears to fix the issue I

Re: PATCH: fixed issue in doPrepared

2008-12-04 Thread Tom Emerson
On Thu, Dec 4, 2008 at 2:44 PM, Stephen C. Gilardi [EMAIL PROTECTED] wrote: Thanks for the report. I had made an accidental checkin at svn258. I've reverted to code identical to svn257 which I believe is correct. Please give it a try. That did it, thanks! -tree -- Tom Emerson [EMAIL

Re: Elegant but very slow

2008-12-04 Thread Daniel Eklund
I On Dec 4, 2:55 pm, PeterB [EMAIL PROTECTED] wrote: Hi, I downloaded clojure_20080916.zip and had a go with a simple tree benchmark (cut-down version of the one in the computer language shootout  http://shootout.alioth.debian.org/). The Java version is pretty simple and runs in about 2s

Re: Elegant but very slow

2008-12-04 Thread Daniel Eklund
ahhh... to answer my own question (and if I had looked at the code and the API a bit closer), it turns out that recur can only be used in tail-position... and your code (as a tree-recursor) would not benefit from this. On Dec 4, 5:39 pm, Daniel Eklund [EMAIL PROTECTED] wrote: oops... I am

Re: Elegant but very slow

2008-12-04 Thread Meikel Brandmeyer
Hi, Am 04.12.2008 um 20:55 schrieb PeterB: However, there is a heavy price to be paid for this elegance: 'Elapsed time: 100730.161515 msecs' Ouch! That's rather disappointing :-( Any suggestions for improving the performance?

Running out of memory when using filter?

2008-12-04 Thread Paul Mooser
I've been writing a few different functions that return and operate on some very long sequences. Everything I've been doing has been written in terms of underlying operations that are described as lazy, so I assumed everything would be fine as long as I don't retain the head of any sequences.

Re: Elegant but very slow

2008-12-04 Thread bOR_
    (reduce #(+ %1 %2) 0 (map sum (range 1 (inc iterations can be replaced by (reduce + (map sum (range 1 (inc iterations There is at least some functions in clojure's api for doing unchecked calculations. That should speed up things. I'm not yet familiar enough with clojure or

Re: Elegant but very slow

2008-12-04 Thread bOR_
using (int ..) should also help (type hinting) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email

Re: Elegant but very slow

2008-12-04 Thread Mark Engelberg
I already tried bOR's two suggestions (replace anonymous function with + and type hinting), but they made no difference on my machine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: (doc)strings after param in defn

2008-12-04 Thread Randall R Schulz
On Thursday 04 December 2008 14:41, Meikel Brandmeyer wrote: Hi, Am 04.12.2008 um 18:30 schrieb Mon Key: It looks like I was getting turned around by the implicit do (and by my preconceptions coming from other Lisps where the docstring likes to sit behind the arglist) This doesn't work

Re: (doc)strings after param in defn

2008-12-04 Thread Mon Key
This doesn't work well with Clojure, because you can have multiple argument vectors: (defn foo docstring here ([x] (do-something-with-one-arg x)) ([x y] (we-can-also-do-two x y))) Behind which arglist should we put the docstring. ;) That makes perfect sense, this is the

Re: Running out of memory when using filter?

2008-12-04 Thread Stuart Sierra
On Dec 4, 6:20 pm, Paul Mooser [EMAIL PROTECTED] wrote: However, I'm running out of heap space using the following function to filter my sequences: ... I know that filter is lazy, and I see that the documentation of lazy- cons says that lazy-conses are cached. Cached for what duration ? Does

Re: Elegant but very slow

2008-12-04 Thread Christian Vest Hansen
Ah, disregard that. I found the rules: http://shootout.alioth.debian.org/u32q/benchmark.php?test=binarytreeslang=all#about On Fri, Dec 5, 2008 at 1:04 AM, Christian Vest Hansen [EMAIL PROTECTED] wrote: Is it important that we build and deconstruct a complete tree in the process, or is merely

Capabilities and Limits of (bean ...)?

2008-12-04 Thread Randall R Schulz
Hi, I have a fairly elaborate library for representing roughly JSON-like data. It has the ability to create JavaBean counterparts to any of its values, whether atomic or structured. In order to see how this might interact with (bean ...), I tried this: user= (bean (new Boolean true))

Atoms

2008-12-04 Thread Rich Hickey
I've added a new reference type - atom. Docs here: http://clojure.org/atoms Feedback welcome, Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Capabilities and Limits of (bean ...)?

2008-12-04 Thread Rich Hickey
On Dec 4, 8:01 pm, Randall R Schulz [EMAIL PROTECTED] wrote: Hi, I have a fairly elaborate library for representing roughly JSON-like data. It has the ability to create JavaBean counterparts to any of its values, whether atomic or structured. In order to see how this might interact with

Re: Capabilities and Limits of (bean ...)?

2008-12-04 Thread Randall R Schulz
On Thursday 04 December 2008 17:01, Randall R Schulz wrote: Hi, ... user= (bean (new Boolean true)) java.lang.NoClassDefFoundError: clojure/core$bean__4456$fn__4458 In fact, I've yet to find an invocation of (bean ...) that produces anything other than a NCDFE. ... OK. Here's the

Re: DISCUSS: replace (rand)

2008-12-04 Thread Kyle Schaffrick
On Thu, 4 Dec 2008 00:07:56 -0800 (PST) don.aman [EMAIL PROTECTED] wrote: Since we're being all high-level, it'd be good for a random function which allows us to specify the range of numbers, since % doesn't promise an even spread of probabilities (especially for large ranges). If one plans

Re: Atoms

2008-12-04 Thread Mark Engelberg
Didn't commute essentially give this behavior for refs? How is this different? On Thu, Dec 4, 2008 at 5:02 PM, Rich Hickey [EMAIL PROTECTED] wrote: I've added a new reference type - atom. --~--~-~--~~~---~--~~ You received this message because you are

Re: Atoms

2008-12-04 Thread Larrytheliquid
One difference would be if a ref is already inside of a bigger transaction that failed to commit for other reasons. With atoms it seems like the transaction is implicitly isolated to the atom (instead of explicitly wrapping around a ref.) On Thu, Dec 4, 2008 at 9:26 PM, Mark Engelberg [EMAIL

PATCH: Fix in-case macro from clojure.contrib fcase library

2008-12-04 Thread Tchavdar Roussanov
The attached patch fixes the compile error when in-case macro is used in different name space. The expanded code contains a private function from clojure.contrib.fcase name space. --Tchavdar --~--~-~--~~~---~--~~ You received this message because you are

Re: Atoms

2008-12-04 Thread Krukow
On Dec 5, 2:02 am, Rich Hickey [EMAIL PROTECTED] wrote: I've added a new reference type - atom. Looks useful as a kind of high-level interface to java.util.concurrent.AtomicReference. Am I correct --~--~-~--~~~---~--~~ You received this message because you are

Re: Atoms

2008-12-04 Thread Krukow
On Dec 5, 7:51 am, Krukow [EMAIL PROTECTED] wrote: Looks useful as a kind of high-level interface to java.util.concurrent.AtomicReference. Am I correct to think of this as being (semantically) equivalent to combining send- off and await with agents? E.g., (defn memoize [f] (let [mem

Re: fix imports

2008-12-04 Thread Martin DeMello
On Dec 3, 11:59 pm, Vijay Lakshminarayanan [EMAIL PROTECTED] wrote: This is far from complete and should be expanded but I got this from a few hours of hacking: Good stuff, thanks! martin --~--~-~--~~~---~--~~ You received this message because you are