Re: Modifying data structures without changing their interface

2009-04-20 Thread Timo Mihaljov
Timo Mihaljov wrote: I'm wondering about how to change a data structure without breaking the API used to access it. For example, let's assume that I have a library for dealing with records of people and I'm storing them in structs. (defstruct person :name) The users of my library

Re: Modifying data structures without changing their interface

2009-04-20 Thread Laurent PETIT
Hi, 2009/4/20 Timo Mihaljov noid@gmail.com Timo Mihaljov wrote: I'm wondering about how to change a data structure without breaking the API used to access it. For example, let's assume that I have a library for dealing with records of people and I'm storing them in structs.

European Lisp Symposium 2009: Call for participation

2009-04-20 Thread Marco Antoniotti
Apologies for multiple postings 2nd European Lisp Symposium (ELS 2009) Milan, Italy, May 27-29, 2009 Universita` degli Studi di Milano-Bicocca www.european-lisp-symposium.org

Re: On Stuart's Book

2009-04-20 Thread fft1976
On Apr 19, 3:20 am, Antony Blakey antony.bla...@gmail.com wrote: If I use Clojure commercially, I'll certainly pay for it. Please do not forget to pay for JVM, Java, Linux, tar and others. --~--~-~--~~~---~--~~ You received this message because you are

Re: Modifying data structures without changing their interface

2009-04-20 Thread Timo Mihaljov
Laurent PETIT wrote: While interesting, this approach seems to me limited to simple cases : * limited in possibilities: you are not able to directly use values of other fields. So in more complex cases, you won't be able to combine calculated values without code repetition or prepraration

Re: Modifying data structures without changing their interface

2009-04-20 Thread Laurent PETIT
Hi, 2009/4/20 Timo Mihaljov noid@gmail.com Laurent PETIT wrote: While interesting, this approach seems to me limited to simple cases : * limited in possibilities: you are not able to directly use values of other fields. So in more complex cases, you won't be able to combine

Re: Modifying data structures without changing their interface

2009-04-20 Thread Timo Mihaljov
Laurent PETIT wrote: What do others think about these 2 above statements ? The standard OO approach to information hiding would be private fields and accessor methods. Any suggestions for the One True Clojure Pattern that addresses the same problem? I think accessor

Oracle and Clojure

2009-04-20 Thread Sean Devlin
Okay, I'm willing to bet this crowd has already seen this: http://www.sun.com/third-party/global/oracle/index.jsp Any thoughts on how this affects Clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure

Re: Oracle and Clojure

2009-04-20 Thread hank williams
On Mon, Apr 20, 2009 at 9:13 AM, Sean Devlin francoisdev...@gmail.com wrote: Okay, I'm willing to bet this crowd has already seen this: http://www.sun.com/third-party/global/oracle/index.jsp Any thoughts on how this affects Clojure? No effect. -- blog: whydoeseverythingsuck.com

StackOverflowError Question

2009-04-20 Thread jleehurt
Hi all, I have the following code that trains a perceptron with the given inputs and corresponding desired inputs. For input/output vectors, when the size gets to about 2000, I am getting a java.lang.StackOverflowError in the following function: (defn trainPerceptron [beginningWeightVector

Re: StackOverflowError Question

2009-04-20 Thread David Nolen
You have two other function calls getAdaptedWeightVector computeActualResponse Are these recursive as well? On Sun, Apr 19, 2009 at 11:26 PM, jleehurt jleeh...@gmail.com wrote: Hi all, I have the following code that trains a perceptron with the given inputs and corresponding desired inputs.

Re: Oracle and Clojure

2009-04-20 Thread Sean Devlin
I guess I should have stated my initial concern better. I've had to use several Oracle products in the past (PL/SQL 9i), and they weren't developer friendly. I'm worried about the JVM becoming less open than it currently is. I can see a lot of technologies that drive the open source world,

Re: Modifying data structures without changing their interface

2009-04-20 Thread Matt Clark
Maybe I'm missing something, but what is wrong with Stuart Sierra's solution? I quite like it, and it would probably be more appealing if it were encapsulated into a macro. (def-propholder person) (def me (person {:name Matt Clark})) (def-propholder person2 :name {:getter (fn [record]

Re: Modifying data structures without changing their interface

2009-04-20 Thread Stuart Sierra
On Apr 20, 12:32 pm, Laurent PETIT laurent.pe...@gmail.com wrote: I think you Timo ask here a very interesting and important question. It's not just about having encapsulation or not. It's really about designing the code so that the library internals can evolve without impact on the user

Re: The Path to 1.0

2009-04-20 Thread Phil Hagelberg
Stuart Sierra the.stuart.sie...@gmail.com writes: On Apr 20, 1:48 pm, Rich Hickey richhic...@gmail.com wrote: I imagine a (clojure-version) function returning: {:major 1 :minor 0 :release 0} I'd suggest calling :release something else, like :revision or :patch. release sounds like a

Re: Abstract data types in functional languages

2009-04-20 Thread David Nolen
Konrad added an early implementation of abstract data types to clojure-contrib (types.clj) you might want to check that out. I also did some work on supporting more traditional style OO with Spinoza (structural+behavioral inheritance), but I've sidelined it for the time being until I find that I

Re: Abstract data types in functional languages

2009-04-20 Thread Konrad Hinsen
On 20.04.2009, at 20:00, Timo Mihaljov wrote: Is the concept of Abstract Data Types [1] useful in Clojure? Yes, although the abstraction is necessarily leaky in that you cannot enforce it in the absence of static typing. If yes, how would you implement one? Like in any other language: by

Re: The Path to 1.0

2009-04-20 Thread Laurent PETIT
2009/4/20 Stuart Sierra the.stuart.sie...@gmail.com On Apr 20, 1:48 pm, Rich Hickey richhic...@gmail.com wrote: I imagine a (clojure-version) function returning: {:major 1 :minor 0 :release 0} I'd suggest calling :release something else, like :revision or :patch.  release sounds like a

Re: The Path to 1.0

2009-04-20 Thread Laurent PETIT
2009/4/20 Rich Hickey richhic...@gmail.com: If there is just a (def *version* {:major 1 :minor 0 :release 0}) my questions are: What happens after release to keep subsequent interim versions from having the same 'version' as a release? Should we have a :status attribute that is :release

Re: Modifying data structures without changing their interface

2009-04-20 Thread Laurent PETIT
Hi David, 2009/4/20 David Nolen dnolen.li...@gmail.com: A couple of things. In your initial example, you conflated some things. One issue is simply a matter of convenience- defining a getter so that you can use Python object property access (via the dot operator). Personally I don't like

Wrapper function for slime

2009-04-20 Thread Craig McDaniel
Using something like this run-slime wrapper to start slime may be useful to others. It helps me avoid some issues when moving from project to project without restarting emacs. Assuming jar files reside in each separate project's own lib directory, Clojure source in its src directory, and compiled

Re: Modifying data structures without changing their interface

2009-04-20 Thread Mark Engelberg
On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote: If you promise that functions will accept and return maps with certain keys, then you must keep that promise moving forward. I think you're missing part of the point of the original post. You don't really want to

Re: 'first vs 'nth on maps

2009-04-20 Thread Hugh Winkler
On Mon, Apr 20, 2009 at 1:59 PM, David Nolen dnolen.li...@gmail.com wrote: Maps aren't ordered so this isn't a good idea anyway. It's a good idea if you have a sorted map. My example should have used sorted-map. The reason first/second work is because they call seq on the collection. (key

Re: Problem with CLASSPATH

2009-04-20 Thread Adam Blinkinsop
On Apr 5, 1:32 pm, dlb d...@davidlballenger.com wrote: I have the same problem on my Mac as well, i.e. if clojure.jar is loaded from ~/Library/Java/Extensions rather than from the classpath, then clojure does not find files on the classpath.  I did some poking around and on my Mac OS X 10.5.6

Re: Oracle and Clojure

2009-04-20 Thread Greg Harman
Has anyone here been able to install Clojure on IcedTea? For what it's worth, I run Clojure on SoyLatte and have never had a problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

shortcut for for comprehension

2009-04-20 Thread Michael Hunger
Is it possible to use :while to shortcut a for macro when a certain number of yiels have happened? e.g. (for [x (range 1000) :when (= (rem x) 1) :while (number of yields = 10)] so i want only the first 10 results. Or should I just use (take 10 ) on the for ? Michael

macro expansion time

2009-04-20 Thread Mark Volkmann
In my Clojure article at http://ociweb.com/mark/clojure/article.html I say: Clojure code is processed in three phases: read-time, compile-time and run-time. At read-time the Reader reads source code and converts it to a data structure, mostly a list of lists of lists At compile-time this

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
Hello, Apparently, no: 1:85 user= (macroexpand-1 '(defn hello [] world)) (def hello (clojure.core/fn ([] world))) 1:86 user= (read-string (defn hello [] \world\)) (defn hello [] world) 1:87 user= read-string did not expand defn. I think it's 'eval that expands macros and compiles forms.

Re: macro expansion time

2009-04-20 Thread Mark Volkmann
I didn't explain my question well enough. Suppose I define a macro with defmacro and have several calls to it in my code. When are those calls expanded to the code inside the macro? Is that at read-time? On Mon, Apr 20, 2009 at 5:34 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Hello,

Re: macro expansion time

2009-04-20 Thread Meikel Brandmeyer
Hi Mark, Am 21.04.2009 um 00:40 schrieb Mark Volkmann: I didn't explain my question well enough. Suppose I define a macro with defmacro and have several calls to it in my code. When are those calls expanded to the code inside the macro? Is that at read-time? As Laurent said: No. Macro

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
2009/4/21 Mark Volkmann r.mark.volkm...@gmail.com: I didn't explain my question well enough. Suppose I define a macro with defmacro and have several calls to it in my code. When are those calls expanded to the code inside the macro? Is that at read-time? Maybe the example I gave (by using

Re: macro expansion time

2009-04-20 Thread Laurent PETIT
But reader macros *are* expanded at read-time (as their name indicates, BTW) : 1:91 user= (read-string 'quoted-symbol) (quote quoted-symbol) 1:92 user= HTH, -- Laurent 2009/4/21 Laurent PETIT laurent.pe...@gmail.com: 2009/4/21 Mark Volkmann r.mark.volkm...@gmail.com: I didn't explain my

Re: The Path to 1.0

2009-04-20 Thread Antony Blakey
On 21/04/2009, at 5:12 AM, Laurent PETIT wrote: To give you more ideas, there is a convention in tools like maven/ivy that when you're starting the hack on a branch targeting some version M.m.r , you immediately rename the place in code where you maintain the version number by appending the

Re: Modifying data structures without changing their interface

2009-04-20 Thread mikel
On Apr 20, 4:17 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote: If you promise that functions will accept and return maps with certain keys, then you must keep that promise moving forward. I think you're

Re: The Path to 1.0

2009-04-20 Thread Daniel Jomphe
Laurent PETIT wrote: I'd suggest calling :release something else, like :revision or :patch. I like the term service used in Eclipse terminology: the service segment indicates bug fixes (The numbering scheme for Eclipse uses major, minor, service and qualifier : the qualifier segment

Re: shortcut for for comprehension

2009-04-20 Thread Timothy Pratley
As far as I know the number of yields is not available for testing, so you have to use take user= (take 10 (for [x (range 1000) :when (= (rem x 2) 1)] x)) (1 3 5 7 9 11 13 15 17 19) On Apr 21, 8:19 am, Michael Hunger cloj...@jexp.de wrote: Is it possible to use :while to shortcut a for macro

Re: Oracle and Clojure

2009-04-20 Thread Dan
On Mon, Apr 20, 2009 at 6:12 PM, Greg Harman ghar...@gmail.com wrote: Has anyone here been able to install Clojure on IcedTea? For what it's worth, I run Clojure on SoyLatte and have never had a problem. I never had any problem on IcedTea.

Re: The Path to 1.0

2009-04-20 Thread Rich Hickey
On Apr 20, 2009, at 7:02 PM, Antony Blakey wrote: On 21/04/2009, at 5:12 AM, Laurent PETIT wrote: To give you more ideas, there is a convention in tools like maven/ivy that when you're starting the hack on a branch targeting some version M.m.r , you immediately rename the place in code

Re: The Path to 1.0

2009-04-20 Thread Antony Blakey
On 21/04/2009, at 10:22 AM, Rich Hickey wrote: I'm unfamiliar with the POM version coordinate system - any hints? My comment was in support of Laurent's proposal. I'm a relative maven newb, but this is my take: POMs use the concept of a coordinate, which is

Re: The Path to 1.0

2009-04-20 Thread Antony Blakey
On 21/04/2009, at 10:51 AM, Antony Blakey wrote: On 21/04/2009, at 10:22 AM, Rich Hickey wrote: I'm unfamiliar with the POM version coordinate system - any hints? My comment was in support of Laurent's proposal. I'm a relative maven newb, but this is my take: POMs use the concept of a

Re: The Path to 1.0

2009-04-20 Thread Daniel Jomphe
Rich Hickey wrote: I'm unfamiliar with the POM version coordinate system - any hints? Maven takes the version as whatever-formatted string, but recognizes a conventional (.endsWith 1.0.0-SNAPSHOT -SNAPSHOT), like described by Laurent PETIT. So whatever-SNAPSHOT means we're going someday to

Re: The Path to 1.0

2009-04-20 Thread Mark Derricutt
For a 1.0 release I'd love to see some support for JDK annotations somehow, at both the gen-class and method level at least. Mark On Fri, Apr 17, 2009 at 4:53 AM, Rich Hickey richhic...@gmail.com wrote: This is mostly about - does it work? Is it relatively free of bugs? Is it free of gaping

How to shutdown only some agents that were sent-off?

2009-04-20 Thread billh04
In my application, I can open several windows. Each window is an independent unit and will send-off three agents to do background work. When I close a window, I stop the three threads from running, but the thread count never goes down when I display it by (println Thread count is

Re: Modifying data structures without changing their interface

2009-04-20 Thread Bradbev
On Apr 20, 2:17 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote: If you promise that functions will accept and return maps with certain keys, then you must keep that promise moving forward. I think you're missing

ICFP 2009

2009-04-20 Thread Andrew Wagner
It would be fun to have a team of clojure programmers work on the ICFP '09 contest. Has this been done previously? Anybody interested? I'm new to clojure and to lisps in general, but have a pretty good grasp of functional programming (mostly from haskell). It would be great fun to work with some

Re: StackOverflowError Question

2009-04-20 Thread jleehurt
Hi David, Those two are not recursive, but they call into other recursive functions. Do I need to make sure all recursive functions use the loop/ recur pattern? Or maybe not nest recursive calls like this? Here is the whole source: ;threshold (defn threshold [x] (if (= x 0) 1 0)) ;signum

Re: StackOverflowError Question

2009-04-20 Thread jleehurt
Hi David, Those two are not recursive, but they call into other functions that are. Do I need to make sure that all recursive functions use the loop/ recur pattern? Or should I not nest recursive calls like this? Here is the whole source: ;; Neuron Activation Functions ;threshold (defn

Clojure Library

2009-04-20 Thread Brian Doyle
I posted this a couple of weeks ago and haven't seen it updated on the clojure website. Maybe it got lost in the shuffle. Name: clj-web-crawler URL: http://github.com/heyZeus/clj-web-crawler/tree/master Author: Brian Doyle Categories: Web, Automation License: MIT Dependencies: clojure,

Re: The Path to 1.0

2009-04-20 Thread Laurent PETIT
Daniel, I have not followed maven2 concerning this qualifier thing. Would it be corrrect to say that, to further extend you examples, one the qualifiers could be slim, since clojure ant already has such a target. Or would a slim jar of clojure have to had another artifactId ? (I don't think

Re: Oracle and Clojure

2009-04-20 Thread AlamedaMike
I can see a lot of technologies that drive the open source world, and this group, being compromised Nothing's going to happen, for the simple reason that the cost to Oracle's reputation would far outweigh anything they might gain from charging for open-source products. The ultimate effect