Re: Question about building modular code in Clojure

2009-05-18 Thread Feng
On May 17, 3:24 pm, Mark Engelberg wrote: > Thanks for your questions.  I'll try to explain better. > > First, I'll explain that my line of work is to build tools to generate > puzzles.  I often have a module which generates the puzzles through > various random processes, using certain probabil

Re: Clojure at JavaOne

2009-05-18 Thread AlamedaMike
+1 for showing the Ant demo and modifying it while it's running. Emphasize how easy it is to get RELIABLE concurrency using agents/STM. As Steve Jobs has long known, eye candy counts, and Ants is an eye candy way of seeing concurrency in action. I would also keep a second REPL open and "test" out

Re: OutOfMemoryError with clojure.contrib.sql and large result sets

2009-05-18 Thread Stephen C. Gilardi
On May 18, 2009, at 4:10 AM, Mark Addleman wrote: The problem is likely in the MySQL's JDBC driver. Some retrieve the entire result set from the database on statement execute while others are more true to the notion of a remote database cursor. The JDBC API has a workaround for this problem:

Adding additional domains for remote javadocs

2009-05-18 Thread b
I was attempting to add an additional remote javadoc source for 'javax.servlet.', but found that the entry for 'javax.' wasn't allowing the domain to be searched. Someone in #clojure mentioned changing line 70 of clojure.contrib.repl- utils/javadoc.clj to return a rseq of *remote-javadocs*. In t

Re: error-kit + test-is

2009-05-18 Thread joshua-choi
I'd love for that to happen—either error-kit support in test-is or test-is support in error-kit. clojure.contrib libraries should be able to use each other with no worries, since they'll be installed together just about always. On May 17, 12:52 am, Dan Larkin wrote: > Sorry for the necro, but I

Re: Clojure at JavaOne

2009-05-18 Thread e
i think destructuring is awesome, and loop-recur loop-recur is so handy in not having to have the public version of a function (entry point) versus the recursive inner version that often has extra parameters that the user shouldn't have to worry about. other ideas: closures as light-weight obj

Re: error-kit: passing a variable error type into a handle statement

2009-05-18 Thread Chouser
On Mon, May 18, 2009 at 4:38 PM, samppi wrote: > > I want to create a function that takes a variable of an error-kit > error type and inserts it into a handle statement, but when I try, I > get a strange error. What does the error mean, and is there a way to > pass a variable error type into a ha

error-kit: passing a variable error type into a handle statement

2009-05-18 Thread samppi
I want to create a function that takes a variable of an error-kit error type and inserts it into a handle statement, but when I try, I get a strange error. What does the error mean, and is there a way to pass a variable error type into a handle statement without resorting to macros? Clojure 1.0.0

Re: Minor bug in int-array, long-array, float-array and double-array

2009-05-18 Thread Frantisek Sodomka
Sorry, forgot to mention: Found when testing Clojure 1.0.0. Frantisek --~--~-~--~~~---~--~~ 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

Minor bug in int-array, long-array, float-array and double-array

2009-05-18 Thread Frantisek Sodomka
It looks that there is a bug in int-array, long-array, float-array and double-array when creating an array using an empty sequence. Doc: clojure.core/int-array ([size-or-seq] [size init-val-or-seq]) Creates an array of ints This works: user=> (int-array 0) # user=> (vec (int-array 0)) [] user=

monad tutorial question

2009-05-18 Thread Stuart Halloway
When working through Part 3 of the monad tutorial [1], I am seeing the following behavior for fib-trace: (fib-trace 3) => [2 [[[1 1] [[[0 0] []] [[2 1] [[[1 1] [ According to the tutorial, it should be: (fib-trace 3) => [2 [[1 1] [0 0] [2 1] [1 1]]] Am I doing something wrong

Re: Clojure at JavaOne

2009-05-18 Thread Mark Volkmann
On Mon, May 18, 2009 at 2:36 PM, Michael Wood wrote: > > On Mon, May 18, 2009 at 8:54 PM, Mark Volkmann > wrote: >> >> I think time is the issue here. The Ant code may be too involved to >> describe in the time allotted. I do think it's important though to >> describe the use of Refs and STM. To

Re: Clojure at JavaOne

2009-05-18 Thread Mark Engelberg
For me, persistent vectors was the killer feature that drew me to Clojure. Don't know how to convey the value of that in 4 minutes, though. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Clojure at JavaOne

2009-05-18 Thread Michael Wood
On Mon, May 18, 2009 at 8:54 PM, Mark Volkmann wrote: > > I think time is the issue here. The Ant code may be too involved to > describe in the time allotted. I do think it's important though to > describe the use of Refs and STM. To me they are a very important > feature of Clojure. They may be

Re: Clojure at JavaOne

2009-05-18 Thread Mark Volkmann
I think time is the issue here. The Ant code may be too involved to describe in the time allotted. I do think it's important though to describe the use of Refs and STM. To me they are a very important feature of Clojure. On Mon, May 18, 2009 at 10:47 AM, bOR_ wrote: > > Well, the ant demo does s

Re: clojure-mode install on Windows XP does not work, for me

2009-05-18 Thread klang
Using my existing definitions (setq clojure-src-root "~/lisp/clj") (setq swank-clojure-extra-classpaths (cons (concat clojure-src-root "/swank-clojure") (when (file-directory-p "~/.clojure") (directory-files "~/.clojure" t ".jar$" This does not work, with "origin/mas

Re: clojure-mode install on Windows XP does not work, for me

2009-05-18 Thread klang
That did the trick! Thanks! Hopefully, this will be a help for other new clojure/emacs/slime/swank users! /klang On May 18, 7:02 pm, Phil Hagelberg wrote: > klang writes: > > First things first: > > > swank doesn't load and slime can't connect to the *inferior-lisp* > > running clojure > > >

Re: Best practices for Slime with Clojure

2009-05-18 Thread Brian Carper
On May 16, 12:58 am, Glen Stampoultzis wrote: > The other problem I have is with the current working directory.  The swank > process seems to use my home directory as the current working > directory regardless of what the current working directory of emacs > currently is.  Is there any way to set

Re: clojure-mode install on Windows XP does not work, for me

2009-05-18 Thread Paul Stadig
I just happened to be setting up emacs an a new Ubuntu install today. I think it might have something to do with 'add-classpath. The swank-clojure-init function is trying to add the swank-clojure directory to the classpath, but the 'require still fails when starting up the clojure REPL. I added th

Re: clojure-mode install on Windows XP does not work, for me

2009-05-18 Thread Phil Hagelberg
klang writes: > First things first: > > swank doesn't load and slime can't connect to the *inferior-lisp* > running clojure > > I am missing something obvious, please advice. It's not your fault; it looks like the latest Clojure 1.1 snapshot is not compatible with swank-clojure. I haven't been

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
On Mon, May 18, 2009 at 2:16 AM, Meikel Brandmeyer wrote: > If that is true, you should maybe consider some glue. > >     /- Analysis > Glue -- Solve >     \- Create > > The Glue part combines/uses the different modules. There you > could change parameters easily with binding, swap in another > a

Re: Classpath problem with r1369 ?

2009-05-18 Thread Paul Mooser
Thanks for the reply, Rich. I'll have to see if I can find another way to make this work, but it has been really nice so far having the ability to add things to the classpath that weren't specified at launch time. Most of what I am doing is in fact at a REPL, because I have clojure embedded insi

clojure-mode install on Windows XP does not work, for me

2009-05-18 Thread klang
First things first: swank doesn't load and slime can't connect to the *inferior-lisp* running clojure I am missing something obvious, please advice. ..this is what I did: Starting up cygwin, I prepare to install clojure. mkdir -p ~/lisp/clj cd ~/lisp/clj git clone git://github.com

Re: Classpath problem with r1369 ?

2009-05-18 Thread Paul Mooser
Thanks for the reply, Rich - I'll have to see if I can find another way to get this to work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
On Mon, May 18, 2009 at 4:23 AM, Laurent PETIT wrote: > The most modular I can think of right now is just about creating a > gravity type and using multimethods for all your functions. > > This way you would have dynamic resolution of methods that do not work > with precompiled fns. Can you elab

Re: Best practices for Slime with Clojure

2009-05-18 Thread Phil Hagelberg
Glen Stampoultzis writes: > I've recently been trying to work with Emacs and Slime on Windows > using Clojure Box. Having never used emacs at all it is tough > going.  I had a question or two regarding best practices. > > The first is regarding classpaths.  I've managed to figure out how to > se

Re: Clojure at JavaOne

2009-05-18 Thread bOR_
Well, the ant demo does show java interoperability (the whole graphics bit). You could start with a world with the empty square, and a filled square, start with one type of ant that is just lugging the food from the filled to the empty square. This shows off agents. Have four numbers being print

Re: Clojure at JavaOne

2009-05-18 Thread bOR_
Well, the ant demo does show java interoperability (the whole graphics bit). You could start with a world with the empty square, and a filled square, start with one type of ant that is just lugging the food from the filled to the empty square. This shows off agents. Have four numbers being print

Re: Clojure at JavaOne

2009-05-18 Thread bOR_
Well, the ant demo does show java interoperability (the whole graphics bit). You could start with a world with the empty square, and a filled square, start with one type of ant that is just lugging the food from the filled to the empty square. This shows off agents. Have four numbers being print

Re: La Clojure plugin for IntelliJ IDEA updated

2009-05-18 Thread Ilya Sergey
Hello, Asbjørn. For now IntelliJ support of Clojure is rather editor-oriented than REPL-oriented. For now you may only run REPL on some of your files. REPL History and other support is now under development and it will be added in the next release. With best regards, Ilya 2009/5/15 Asbjørn Bjørn

Re: Clojure at JavaOne

2009-05-18 Thread Dan Larkin
On May 18, 2009, at 9:23 AM, Laurent PETIT wrote: > > 2009/5/18 Mark Volkmann : >> >> On Mon, May 18, 2009 at 7:36 AM, Rich Hickey >> wrote: >>> >>> I'll be doing two sessions involving Clojure at JavaOne this June. >>> One >>> is a traditional talk (TS-4164), the other is as a participant

Re: Clojure at JavaOne

2009-05-18 Thread Ilya Sergey
Hi all. One of the most important aspects which I would like to be emphasized is the ad-hoc interoperability with Java, such as invocation of Java classes and methods, proxies and compilation to Java class-files. BTW, I will be at JavaOne staying most part of time on JetBrains booth, so if someone

Re: Clojure at JavaOne

2009-05-18 Thread falcon
I agree with John. For certain applications, the ability to modify the code while it is running is very useful. Many language comparisons turn into syntax comparisons. Clojure has enough interesting concepts (concurrency model, code as data, macros) that it should be made to stand out. On May

Re: Clojure at JavaOne

2009-05-18 Thread verec
Whatever you chose, you probably ought to show its source with an IDE (whichever you chose: NetBeans. Eclipse, IntelliJ) but should probably forget about emacs: many (most?) Java developers won't even consider anything that isn't at least partially integrated within some IDE. Not sure how much wo

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Konrad Hinsen
On May 18, 2009, at 15:10, aperotte wrote: > I was going to attempt to implement the data structure in clojure > initially, but I wanted to make it as close a cousin to the other data > structures as possible. I also wanted to easily integrate the use of > the data structure with other math libr

Re: Clojure at JavaOne

2009-05-18 Thread John Newman
I believe it was the presentation you gave on the ants simulation, where you updated the program while it was running. I'm not sure if the other languages in the shootout can do that, but I thought that was pretty awesome. I think a display of building an application while it's running in front o

Re: Clojure at JavaOne

2009-05-18 Thread Laurent PETIT
2009/5/18 Mark Volkmann : > > On Mon, May 18, 2009 at 7:36 AM, Rich Hickey wrote: >> >> I'll be doing two sessions involving Clojure at JavaOne this June. One >> is a traditional talk (TS-4164), the other is as a participant in the >> Script Bowl 2009: A Scripting Languages Shootout (PAN-5348). >

Re: Clojure at JavaOne

2009-05-18 Thread Laurent PETIT
As a general idea, I would say : specific to lisp: the possibility to get rid of "boiler plate code", such as the one involved in each and every (re)implementation of some GOF design patterns. This could be either a demonstration of the power of higher order functions or macros (the first with h

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread aperotte
Thanks for the information Konrad. I haven't had a chance to take a close look at monads, but you've bumped it much higher on my list of things to look at. I was going to attempt to implement the data structure in clojure initially, but I wanted to make it as close a cousin to the other data str

Re: Clojure at JavaOne

2009-05-18 Thread Mark Volkmann
On Mon, May 18, 2009 at 7:36 AM, Rich Hickey wrote: > > I'll be doing two sessions involving Clojure at JavaOne this June. One > is a traditional talk (TS-4164), the other is as a participant in the > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348). > > The 'script' bowl is a friendly

Re: Clojure at JavaOne

2009-05-18 Thread Andrew Wagner
I can only speak from my experience, but the thing that really got my attention was the idea of 'code as data'. In particular, for me, looking through Koza's Genetic Programming book blew my mind. It would be cool to come up with a nice GP demo. On Mon, May 18, 2009 at 8:36 AM, Rich Hickey wrote:

Clojure at JavaOne

2009-05-18 Thread Rich Hickey
I'll be doing two sessions involving Clojure at JavaOne this June. One is a traditional talk (TS-4164), the other is as a participant in the Script Bowl 2009: A Scripting Languages Shootout (PAN-5348). The 'script' bowl is a friendly competition, basically a place to show off your language and se

Re: Clojure and Jacob

2009-05-18 Thread Meikel Brandmeyer
Hi, Am 18.05.2009 um 13:56 schrieb Emeka: I found that the VisualBasic help of Excel can be easily translated to such method calls. Could you explain this further even with links or examples? I'm sorry. I'm at home now, so I can't check the actual file name and location in the system. But it

Re: Classpath problem with r1369 ?

2009-05-18 Thread Rich Hickey
On May 17, 2:19 pm, Paul Mooser wrote: > Is anyone having contrary results, or does anyone know of a way to > call add-classpath and have it actually work with an up-to-date trunk > build of clojure ? This basically breaks my common usage of clojure, > because it requires me to pass all class

Re: Clojure and Jacob

2009-05-18 Thread Emeka
Meikel, Thanks so much, it is working now. > I found that the VisualBasic help of Excel can be easily > translated to such method calls. Could you explain this further even with links or examples? (def wb (.. Dispatch (call wbl "Open" @adir)(toDispatch))) I wanted to use file chooser to ass

Re: Question about building modular code in Clojure

2009-05-18 Thread Laurent PETIT
Hi, The most modular I can think of right now is just about creating a gravity type and using multimethods for all your functions. This way you would have dynamic resolution of methods that do not work with precompiled fns. 2009/5/17 Mark Engelberg : > > Thanks for your questions.  I'll try to

Re: Question about building modular code in Clojure

2009-05-18 Thread Meikel Brandmeyer
Hi, Am 18.05.2009 um 12:42 schrieb Konrad Hinsen: Such a use of binding will lead to bad surprises as soon as you use it with lazy sequences: (map #(lcm % 6) (range 6)) -> (0 6 6 6 12 30) (binding [clojure.contrib.math/gcd (fn [a b] 1)] (map #(lcm % 6) (range 6))) -> (0 6 6 6 12 30) You ha

Re: Question about building modular code in Clojure

2009-05-18 Thread Laurent PETIT
2009/5/18 Konrad Hinsen : > > On May 18, 2009, at 11:58, Adrian Cuthbertson wrote: > >> I know I keep plugging this - sorry - but it just keeps surfacing >> as a solution; >> >> (lcm 4 6) >> 12 >> (binding [clojure.contrib.math/gcd (fn [a b] 1)] (lcm 4 6)) >> 24 > > Such a use of binding will lead

Re: Question about building modular code in Clojure

2009-05-18 Thread Adrian Cuthbertson
Aha! Thank you for clarifying that. Reinforces your point on monkey-patching :). I will read your blog post with careful attention. Adrian. On Mon, May 18, 2009 at 12:42 PM, Konrad Hinsen wrote: > > On May 18, 2009, at 11:58, Adrian Cuthbertson wrote: > >> I know I keep plugging this - sorry -

Re: Question about building modular code in Clojure

2009-05-18 Thread Konrad Hinsen
On May 18, 2009, at 11:58, Adrian Cuthbertson wrote: > I know I keep plugging this - sorry - but it just keeps surfacing > as a solution; > > (lcm 4 6) > 12 > (binding [clojure.contrib.math/gcd (fn [a b] 1)] (lcm 4 6)) > 24 Such a use of binding will lead to bad surprises as soon as you use

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Anand Patil
On Mon, May 18, 2009 at 10:54 AM, Konrad Hinsen wrote: > > On May 18, 2009, at 11:21, Anand Patil wrote: > > > Huh, sounds like just the thing. Security is going to be especially > > difficult in Clojure, though. For example, say I stuck the array > > into a ref from within the monad, then carried

Re: Question about building modular code in Clojure

2009-05-18 Thread Adrian Cuthbertson
On Mon, May 18, 2009 at 11:29 AM, Mark Reid wrote: > ... > test=> (lcm 4 6) > 24 > > > Maybe a variant of ns could be written that allows the overriding of > specific functions? e.g., > I know I keep plugging this - sorry - but it just keeps surfacing as a solution; (lcm 4 6) 12 (binding [

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Konrad Hinsen
On May 18, 2009, at 11:21, Anand Patil wrote: > Huh, sounds like just the thing. Security is going to be especially > difficult in Clojure, though. For example, say I stuck the array > into a ref from within the monad, then carried on overwriting it. A > consumer who gets the array out of t

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Reid
> What's wrong with this: > > user=> (ns test (:use [clojure.contrib.math :exclude (lcm)])) > nil > test=> (sqrt 2) > 1.4142135623730951 > test=> (lcm 3 6) > java.lang.Exception: Unable to resolve symbol: lcm in this context > (NO_SOURCE_FILE:3) > test=> (defn lcm [a b] 1) > #'test/lcm > test=> (l

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Anand Patil
On Sun, May 17, 2009 at 1:15 PM, Konrad Hinsen wrote: > > On 16.05.2009, at 15:53, aperotte wrote: > > > Yes Anand, I'm worried about that. What I think the solution should > > be is to allow mutability in the implementation of algorithms in the > > java back end for the reasons you mentioned, bu

Re: Question about building modular code in Clojure

2009-05-18 Thread Michael Wood
On Mon, May 18, 2009 at 11:07 AM, Michael Wood wrote: > On Mon, May 18, 2009 at 9:47 AM, Mark Engelberg > wrote: >> >> On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen >> wrote: >>>  It's the approach of "cloning and >>> mutating" something that smells of "quick and dirty", although I >>> agree

Re: Question about building modular code in Clojure

2009-05-18 Thread Meikel Brandmeyer
Hi, Am 18.05.2009 um 09:47 schrieb Mark Engelberg: As an example, I authored clojure.contrib.math. Someone came up with a slightly faster algorithm for one of the functions (which is used in turn by other functions in the library), but I can't include it unless he signs a contributor agreement

Re: Question about building modular code in Clojure

2009-05-18 Thread Michael Wood
On Mon, May 18, 2009 at 9:47 AM, Mark Engelberg wrote: > > On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen > wrote: >>  It's the approach of "cloning and >> mutating" something that smells of "quick and dirty", although I >> agree it is quite convenient in the prototyping phase. > > I disagree t

Re: Question about building modular code in Clojure

2009-05-18 Thread Konrad Hinsen
On May 18, 2009, at 9:47, Mark Engelberg wrote: > On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen > wrote: >> It's the approach of "cloning and >> mutating" something that smells of "quick and dirty", although I >> agree it is quite convenient in the prototyping phase. > > I disagree that incre

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
On Mon, May 18, 2009 at 1:17 AM, Adrian Cuthbertson wrote: > (alter-var-root (var say-grav) (fn [_] (fn [x] (prn "my-version-grav:" x But this only works if you only want one variation, and you no longer care about the original version, right?. If you want to benchmark your variation agains

Re: Question about building modular code in Clojure

2009-05-18 Thread Adrian Cuthbertson
> ... signs a contributor agreement. If he wants to create his own > version of the module for his own personal use, in which he swaps out > my function for his faster one, there appears to be no good way to do > this, short of copying my entire file, commenting out my function, ... I think Stua

Re: OutOfMemoryError with clojure.contrib.sql and large result sets

2009-05-18 Thread Mark Addleman
The problem is likely in the MySQL's JDBC driver. Some retrieve the entire result set from the database on statement execute while others are more true to the notion of a remote database cursor. The JDBC API has a workaround for this problem: Use Statement.setFetchSize(int) to limit the number

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen wrote: > It's the approach of "cloning and > mutating" something that smells of "quick and dirty", although I > agree it is quite convenient in the prototyping phase. I disagree that incremental extension of a module is a "quick and dirty" prototy

Re: Clojure and Jacob

2009-05-18 Thread Meikel Brandmeyer
Hi, Am 17.05.2009 um 22:28 schrieb Emeka: (def c (.. Dispatch (call ws "Cells" 1 1) (toDispatch))) Here you retrieve the actual cell. If I have file "hello.xls" already and I have say 'Emeka at Cell 1 1, using the above line could I get 'Emeka . Yes. Instead of using Add to create a new Wo