Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
David, that seems to work. I think I can achieve my objectives with this strategy. However, I must admit, I find it rather unsettling that collections of functions written inside of namespaces are fundamentally less composable than those that are not. It means that to remain extensible, I need

Re: Question about building modular code in Clojure

2009-05-18 Thread Konrad Hinsen
On 17.05.2009, at 21:24, Mark Engelberg wrote: For many years, my primary language for doing these sorts of programs has been Python. In my first pass, I just have a bunch of functions in a file with global variables at the top. For exploring simple changes, I can just import a file and

Re: Question about building modular code in Clojure

2009-05-18 Thread Mark Engelberg
BTW, for those of you interested in reading academic papers about modules in functional programming langs, I found this list of articles: http://www.readscheme.org/modules/ I remember reading about PLT Scheme's units several years ago, and I think it's pretty much what I'm looking for, with the

Re: Question about building modular code in Clojure

2009-05-18 Thread Konrad Hinsen
On 18.05.2009, at 08:05, Mark Engelberg wrote: David, that seems to work. I think I can achieve my objectives with this strategy. David provided a much better implementation of the idea that I had for this. I hadn't thought of the load function. However, I must admit, I find it rather

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-18 Thread Stefan Hübner
I've submitted the Maven bundle for Clojure 1.0.0 to http://jira.codehaus.org/browse/MAVENUPLOAD-2464. Processing the request might take a couple of days. Once the bundle is uploaded to Central, one of the following two snippets can be used to declare a dependency to Clojure: !-- Clojure with

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

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 konrad.hin...@laposte.net 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

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 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

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 adrian.cuthbert...@gmail.com 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

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 konrad.hin...@laposte.net 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

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 mark.engelb...@gmail.com wrote: On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen konrad.hin...@laposte.net wrote:  It's the approach of cloning and mutating something that smells of quick and dirty, although I agree it is quite convenient in

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

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 esiot...@gmail.com wrote: On Mon, May 18, 2009 at 9:47 AM, Mark Engelberg mark.engelb...@gmail.com wrote: On Sun, May 17, 2009 at 11:48 PM, Konrad Hinsen konrad.hin...@laposte.net wrote:  It's the approach of cloning and mutating something

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Anand Patil
On Sun, May 17, 2009 at 1:15 PM, Konrad Hinsen konrad.hin...@laposte.netwrote: 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

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= (lcm 3 6) 1

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 the

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 mark.r...@gmail.com 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

Re: Feedback on new persistentmatrix datatype

2009-05-18 Thread Anand Patil
On Mon, May 18, 2009 at 10:54 AM, Konrad Hinsen konrad.hin...@laposte.netwrote: 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

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 it

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 konrad.hin...@laposte.net wrote: On May 18, 2009, at 11:58, Adrian Cuthbertson wrote: I know I keep

Re: Question about building modular code in Clojure

2009-05-18 Thread Laurent PETIT
2009/5/18 Konrad Hinsen konrad.hin...@laposte.net: 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

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

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 mark.engelb...@gmail.com: Thanks for your

Re: Classpath problem with r1369 ?

2009-05-18 Thread Rich Hickey
On May 17, 2:19 pm, Paul Mooser taron...@gmail.com 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

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

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

Re: Clojure at JavaOne

2009-05-18 Thread Mark Volkmann
On Mon, May 18, 2009 at 7:36 AM, Rich Hickey richhic...@gmail.com 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'

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

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

Re: Clojure at JavaOne

2009-05-18 Thread Laurent PETIT
2009/5/18 Mark Volkmann r.mark.volkm...@gmail.com: On Mon, May 18, 2009 at 7:36 AM, Rich Hickey richhic...@gmail.com 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

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

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

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

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 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

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 r.mark.volkm...@gmail.com: On Mon, May 18, 2009 at 7:36 AM, Rich Hickey richhic...@gmail.com wrote: I'll be doing two sessions involving Clojure at JavaOne this June. One is a traditional talk (TS-4164), the

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

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

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

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

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 laurent.pe...@gmail.com 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

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-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

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

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 m...@kotka.de 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

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

2009-05-18 Thread Phil Hagelberg
klang karstenl...@gmail.com 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.

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

Re: Best practices for Slime with Clojure

2009-05-18 Thread Brian Carper
On May 16, 12:58 am, Glen Stampoultzis gst...@gmail.com 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

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 p...@hagelb.org wrote: klang karstenl...@gmail.com writes: First things first: swank doesn't load and slime can't connect to the

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/master,

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_ boris.sch...@gmail.com wrote:

Re: Clojure at JavaOne

2009-05-18 Thread Michael Wood
On Mon, May 18, 2009 at 8:54 PM, Mark Volkmann r.mark.volkm...@gmail.com 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

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 Mark Volkmann
On Mon, May 18, 2009 at 2:36 PM, Michael Wood esiot...@gmail.com wrote: On Mon, May 18, 2009 at 8:54 PM, Mark Volkmann r.mark.volkm...@gmail.com 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

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?

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) #int[] [...@11978b user= (vec

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

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

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 rbysam...@gmail.com 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

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

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 d...@danlarkin.org wrote: Sorry for

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

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:

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: Question about building modular code in Clojure

2009-05-18 Thread Feng
On May 17, 3:24 pm, Mark Engelberg mark.engelb...@gmail.com 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,