preventing problems with default output on bidirectional references

2009-04-21 Thread dawid...@googlemail.com
I am putting together a framework that relies on bidirectional references, but am seeing problems in displaying the results. The default string output of a reference includes the referenced value, but if that refers back to the original reference you end up with an infinite loop and a stack overf

Re: Wrapper function for slime

2009-04-21 Thread Phil Hagelberg
Craig McDaniel writes: > Correction: > > (defun reset-swank () > > (defun run-slime (dir) Here's what I use: (plagiarized from Tim Dysinger) (defun slime-project (path) "Setup classpaths for a maven/clojure project & refresh slime" (interactive "GPath: ") (let ((original-dir default-dir)

Re: 'first vs 'nth on maps

2009-04-21 Thread David Nolen
On Mon, Apr 20, 2009 at 5:17 PM, Hugh Winkler wrote > > > Thanks! I think 'nth ought to behave just like 'first and 'second, > don't you? If it's a good idea for 'first it's a good idea for 'nth. > It does seems like a reasonable behavior for sorted-set and sorted-map, but what else really? Also

Re: Wrapper function for slime

2009-04-21 Thread Craig McDaniel
Correction: (defun reset-swank () "Because changing swank-clojure-extra-classpaths is not enough to force a new instance of slime to use it." (interactive) (setq slime-lisp-implementations (assq-delete-all 'clojure slime-lisp-implementations)) (add-to-list 'slime-lisp-implementati

Re: Anaphora and metadata

2009-04-21 Thread Richard Newman
Ah, that'll do the trick! Thank you so much, Laurent. I should have been able to figure that one out myself... Oh well! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: Anaphora and metadata

2009-04-21 Thread Laurent PETIT
Hi, try (defmacro req-> [[state msg] & body] `(defmethod ~'do-request [Foo ~state ~msg] [~'arg1 ~'arg2 ~(quote #^String arg3)] ~...@body)) HTH, laurent 2009/4/21 Richard Newman : > > Hi folks, > > I'm attempting to define methods within the output of a macro. As > these are definitio

Anaphora and metadata

2009-04-21 Thread Richard Newman
Hi folks, I'm attempting to define methods within the output of a macro. As these are definitions for syntactic benefit more than anything else, I'm using the unquote-quote trick for argument names, so that the input body can refer anaphorically to known names (like "request"). Convention over co

Re: Abstract data types in functional languages

2009-04-21 Thread James Reeves
On Apr 21, 11:41 am, Mark Engelberg wrote: > On Mon, Apr 20, 2009 at 11:00 AM, Timo Mihaljov wrote: > > Is the concept of Abstract Data Types [1] useful in Clojure? > > > If yes, how would you implement one? > > I have composed a lengthy response to this question, and added it to my > blog:http

Re: Oracle and Clojure

2009-04-21 Thread Stuart Sierra
On Apr 20, 9:13 am, Sean Devlin wrote: > http://www.sun.com/third-party/global/oracle/index.jsp > > Any thoughts on how this affects Clojure? Ars Technica has a good analysis, and a fabulous graphic: http://tinyurl.com/csyxos quote: "Oracle is a prominent player in the Java middleware space and

Re: The Path to 1.0

2009-04-21 Thread Laurent PETIT
2009/4/21 Daniel Jomphe : > > Laurent PETIT wrote: >> >  version: 1.0.0-rc1-SNAPSHOT >> >  yields:  clojure-1.0.0-rc1-.jar >> >           (and ...-slim.jar, ...-sources.jar) >> >> There it is. But why having "" in the name of the jar, >> shouldn't it just be "SNAPSHOT" (as far as I remember) ? >>

Re: The Path to 1.0

2009-04-21 Thread Daniel Jomphe
Laurent PETIT wrote: > >  version: 1.0.0-rc1-SNAPSHOT > >  yields:  clojure-1.0.0-rc1-.jar > >           (and ...-slim.jar, ...-sources.jar) > > There it is. But why having "" in the name of the jar, > shouldn't it just be "SNAPSHOT" (as far as I remember) ? > > That is: > > { :major 1 :minor 0 :i

Re: The Path to 1.0

2009-04-21 Thread Laurent PETIT
Hi, 2009/4/21 Daniel Jomphe : > >  version: 1.0.0-rc1-SNAPSHOT >  yields:  clojure-1.0.0-rc1-.jar >           (and ...-slim.jar, ...-sources.jar) There it is. But why having "" in the name of the jar, shouldn't it just be "SNAPSHOT" (as far as I remember) ? That is: { :major 1 :minor 0 :increm

Re: Abstract data types in functional languages

2009-04-21 Thread Laurent PETIT
Well, Once the API has defined correctly documented accessor functions, I think that trying to protect the user from himself at any cost may well be counter productive (in general, of course). Indeed, by not just using regular datastructures anymore for "essential state", you'll loose somehow th

Re: The Path to 1.0

2009-04-21 Thread Daniel Jomphe
Paul Stadig wrote: > Others have commented on the whole groupId, artifactId, etc., etc. But in > terms of the parts of the version number, they are named > ..- as documented here: > > http://www.sonatype.com/books/maven-book/reference/pom-relationships-... Thanks for the info. So I was wrong in

Re: Abstract data types in functional languages

2009-04-21 Thread David Nolen
Nice post thanks for putting it together. My gut feeling is that the need for information hiding is still overinflated, but... until someone builds a 200k LOC Clojure program who will know for sure? Here's my shot at a solution for private data: (defn set-private [m k x] (let [the-meta(meta

Re: The Path to 1.0

2009-04-21 Thread Howard Lewis Ship
On Sat, Apr 18, 2009 at 5:34 AM, Isak Hansen wrote: > > On Thu, Apr 16, 2009 at 6:53 PM, Rich Hickey wrote: >> >> Feedback welcome, >> > > 1. I'd like to see a road map of sorts; plans for where Clojure will > be going with the next couple of releases. > > 2. Clojure-contrib -cleanup >  - Move t

Re: Clojure Library

2009-04-21 Thread Rich Hickey
On Apr 21, 1:16 am, Brian Doyle wrote: > 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. > I'd missed it - sorry. It's up now. Thanks! Rich --~--~-~--~~~---~--~~ You received this

Re: The Path to 1.0

2009-04-21 Thread Paul Stadig
On Mon, Apr 20, 2009 at 8:52 PM, Rich Hickey wrote: > On Apr 20, 2009, at 7:02 PM, Antony Blakey wrote: > > On 21/04/2009, at 5:12 AM, Laurent PETIT wrote: > > > >> { :major 1 :minor 0 :release 0 :status :SNAPSHOT } > >> then > >> { :major 1 :minor 0 :release 0 :status :RC1 } (release candidate

Re: The Path to 1.0

2009-04-21 Thread Daniel Jomphe
Laurent PETIT wrote: > I have not followed maven2 concerning this "qualifier" thing. Right. The first (small) part of my post, which referred to yours, was strictly about versioning, and specifically about the end of the version string, related to snapshots. Then I addressed the classifier as an

Re: Modifying data structures without changing their interface

2009-04-21 Thread Kyle Schaffrick
On Mon, 20 Apr 2009 21:53:41 +0200 Laurent PETIT wrote: > > Hi David, > > 2009/4/20 David Nolen : > > 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

Re: Oracle and Clojure

2009-04-21 Thread Sean Devlin
Thanks to *everyone* for responding! I can see that I was over reacting yesterday. Time for me to stop worrying and get back to coding. Sean On Apr 21, 2:05 am, Adrian Cuthbertson wrote: > There are some precedents - the acquisition of SleepyCat (berkeley db, > et al) - still readily availabl

Re: shortcut for for comprehension

2009-04-21 Thread David Sletten
On Apr 20, 2009, at 12:19 PM, Michael Hunger wrote: > > 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. Is it po

Re: shortcut for for comprehension

2009-04-21 Thread Alvaro Vilanova Vidal
I am a newbie, but seems that "for comprehension" are lazy lists: user> (take 5 (for [x (range 20) :when (do (printf "*%d* " x) (= (rem x 2) 1))] x)) (*0* *1* *2* *3* 1 *4* *5* 3 *6* *7* 5 *8* *9* 7 9) So, I think that you should use take :) 2009/4/21 Michael Hunger > > Is it possible to use

Re: Abstract data types in functional languages

2009-04-21 Thread Mark Engelberg
On Mon, Apr 20, 2009 at 11:00 AM, Timo Mihaljov wrote: > Is the concept of Abstract Data Types [1] useful in Clojure? > > If yes, how would you implement one? I have composed a lengthy response to this question, and added it to my blog: http://programming-puzzler.blogspot.com/2009/04/adts-in-clo

Re: StackOverflowError Question

2009-04-21 Thread Christophe Grand
Hello, (def lazy-identity [x] (lazy-seq x)) (nth (iterate lazy-identity [1 2]) 10) ; returns (1 2) (nth (iterate lazy-identity [1 2]) 1000) ; returns (1 2) (nth (iterate lazy-identity [1 2]) 10) ; (with my JVM settings) throws a StackOverflowException Each time that you are building a lazy

Re: The Path to 1.0

2009-04-21 Thread Laurent PETIT
2009/4/21 AndrewC. : > > On Apr 21, 1:52 am, Rich Hickey wrote: > >> >> I'm unfamiliar with the POM version coordinate system - any hints? >> >> Rich > > 1 Pager on coordinates from the 'definitive guide' > > http://www.sonatype.com/books/maven-book/reference/simple-project-sect-maven-coordinates

Re: The Path to 1.0

2009-04-21 Thread AndrewC.
On Apr 21, 1:52 am, Rich Hickey wrote: > > I'm unfamiliar with the POM version coordinate system - any hints? > > Rich 1 Pager on coordinates from the 'definitive guide' http://www.sonatype.com/books/maven-book/reference/simple-project-sect-maven-coordinates.html --~--~-~--~~

Re: StackOverflowError Question

2009-04-21 Thread Dimiter "malkia" Stanev
Hi Jleehurt, I'm still newbie and don't know, but you have at least two recursive functions - matrixAdd, and matrixMultiplyScalar. I've modified them to work with loop/recur, but I can't tell whether they are with same efficiency (at least no stack problem). Still if I remove the "dorun" from t

Re: StackOverflowError Question

2009-04-21 Thread jleehurt
Hi Dimiter, Thank you! I'm still a bit confused as to why this was happening. Does lazy evaluation not work well with recursion? On Apr 20, 11:06 pm, "Dimiter \"malkia\" Stanev" wrote: > I blindly tried printing out stuff from matrixMultiply, and found out > that if I print matrixA and matrixB