Re: how 'bout a debug-repl?

2009-12-13 Thread George Jahad
What about using a function that throws an exception to quit? The nice thing about using a function to quit is that then you can return values. I've done so here: http://gist.github.com/255883 In addition I've made it so the debug-repl call can wrap a form. If you call quit-dr with no paramete

Re: Binary compatibility and a culture of AOT abuse

2009-12-13 Thread Philipp Meier
Hi, I like to suggest the following policy: publish libraries as jarred- up .clj sources and AOT them locally when building an application. Leiningen could sure help here and everen cache different compiled versions dependening on the clojure version. IIRC this is what Debian does with elisp pack

Re: Binary compatibility and a culture of AOT abuse

2009-12-13 Thread B Smith-Mannschott
On Mon, Dec 14, 2009 at 07:26, mac wrote: > On Dec 13, 11:44 pm, dysinger wrote: >> So in my experiments with using clojure / contrib w/ the "new" branch, >> I've noticed a pattern of binary incompatibility.  Jars pushed to >> clojars, maven repos and other places that are are unnecessarily >> AO

Re: Binary compatibility and a culture of AOT abuse

2009-12-13 Thread mac
On Dec 13, 11:44 pm, dysinger wrote: > So in my experiments with using clojure / contrib w/ the "new" branch, > I've noticed a pattern of binary incompatibility.  Jars pushed to > clojars, maven repos and other places that are are unnecessarily > AOTed, don't work with clojure "new".  I noticed th

Re: peeking at private vars in unit tests

2009-12-13 Thread Chouser
On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi wrote: > > On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: > >> That's great. I wouldn't have expected it to work. Do you think this is by >> design or coincidental/subject to change? > > The expression I gave was: > >       �...@#'clojure.c

Re: what is the correct way to "mvn install" clojure-contrib

2009-12-13 Thread B Smith-Mannschott
On Sun, Dec 13, 2009 at 23:15, dysinger wrote: > I highly recommend you use the snapshots on build.clojure.org.  Lein > already has build.clojure.org snapshots in it's repo list.  You don't > need to do anything more than put > >  :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"] > [org

Re: variation of time macro

2009-12-13 Thread Timothy Pratley
On Dec 14, 3:48 pm, Shawn Hoover wrote: > Is there any interest in an overload of time that takes an > additional parameter for a number of iterations Sounds useful to me! Regards, Tim. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

variation of time macro

2009-12-13 Thread Shawn Hoover
I see usages of the time macro that wrap the expression of interest in a call to dotimes. Is there any interest in an overload of time that takes an additional parameter for a number of iterations, evaluates the expression that many times, and prints the average time in the report? Usage: user> (t

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: > That's great. I wouldn't have expected it to work. Do you think this is by > design or coincidental/subject to change? The expression I gave was: @#'clojure.core/spread equivalent to: (deref (var clojure.core/spread)) I s

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Joost
On 13 dec, 21:19, Richard Newman wrote: > At the risk of going off on a bit of a tangent: > > My experience with teaching OO to university students (and watching my   > own class learn it) suggests that polymorphism -- at least, as   > presented by C++ and Java -- is the hardest concept for beginn

Re: Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-13 Thread mudphone
ataggart (& sean): Thanks! I over-looked that in my haste to respond. lambdatronic: That's a very slick use of "and" in the outer "some!" I quite like that. Thanks to all again. On Dec 11, 5:20 pm, lambdatronic wrote: > This shaves 7 characters off Sean's solution and short circuits just > as

Small line-seq regression?

2009-12-13 Thread Mark Triggs
Hi all, I recently pulled down the latest Clojure master branch and have noticed a small change in line-seq's behaviour which breaks some of my code. The code in question uses line-seq like this: (use 'clojure.contrib.duck-streams) (with-open [ss (java.net.ServerSocket. 4141)] (println (f

Re: peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
Steve, That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? Stu > > On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: > >> (1) Is there already a form that does this? > > Hi Stuart, > > I think the trick is resolving manually: >

Re: Clojure as a 1st language for experienced developer

2009-12-13 Thread kaveh_shahbazian
Thanks to all! I think I should emphasis on some titles; with help of replies I have read and learned about some topics. 1 - I understand that open source world is very wide and it is not all about Java. My question is should I be a good Java developer before starting programming in Clojure? Or c

Binary compatibility and a culture of AOT abuse

2009-12-13 Thread dysinger
So in my experiments with using clojure / contrib w/ the "new" branch, I've noticed a pattern of binary incompatibility. Jars pushed to clojars, maven repos and other places that are are unnecessarily AOTed, don't work with clojure "new". I noticed the same thing going from clojure 1.0 to clojure

Re: what is the correct way to "mvn install" clojure-contrib

2009-12-13 Thread dysinger
I highly recommend you use the snapshots on build.clojure.org. Lein already has build.clojure.org snapshots in it's repo list. You don't need to do anything more than put :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]] in you

Re: How to internally refer to other keys in a hashmap?

2009-12-13 Thread Chas Emerick
I wrote this macro a while ago that allows you to do this in a relatively clean way: http://paste.lisp.org/display/81703 Example usage: => (let-map [a 5 b (+ a 12)]) {:a 5, :b 17} - Chas On Dec 9, 2009, at 1:20 PM, bOR_ wrote: > Hi all, > > I want to make a hash-map where the value of one k

what is the correct way to "mvn install" clojure-contrib

2009-12-13 Thread B Smith-Mannschott
I'm building clojure-contrib locally from source, and would like to use the resulting jar file in other projects, which I'm building with leiningen. To accomplish this, I need to get the clojure-contrib.jar resulting form the build installed in the correct place in ~/.m2/repository. I've been doing

Re: Leiningen Run ?

2009-12-13 Thread Robert Campbell
>> We have talked about adding a run task; >> if you're interested we could even get it in for the 1.0.0 release. I'd definitely like to see that. Right now my deployment sequence looks like: lein compile lein uberjar java -jar myapp-standalone.jar I imagine "lein run" should be able to execute

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: > (1) Is there already a form that does this? Hi Stuart, I think the trick is resolving manually: user=> @#'clojure.core/spread # user=> (@#'clojure.core/spread [:a :b [:c :d]]) (:a :b :c :d) user=> I

peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
(1) Is there already a form that does this? or (2) If not, how can the following be better/simpler: (use 'clojure.contrib.with-ns) (defmacro wall-hack-var "Return the value of a var in a namespace, even if it is private. Intended for test automation." [ns v] `(with-ns '~ns (if

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Richard Newman
> Of course you don't need OO to do polymorphism, and I'm fairly sure > that OO doesn't do polymorphism the best way, but in my estimation the > main reason "classic" OO is so popular is that it provides a very > concrete way to do polymorphism easily. At the risk of going off on a bit of a tangen

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Joost
On 13 dec, 19:48, Raoul Duke wrote: > seems to me that a lot of it comes down to connotations vs. > denotations; I really don't know what you mean by that. > what /is/ OO, anyway? :-) >From what I've seen, it's the association of function implementations with a complex type or data structure.

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Raoul Duke
> objects too. They're not mutually exclusive. It's just that doing > stuff side-effect free pretty much forces you to drop many of the > classic OO patterns. seems to me that a lot of it comes down to connotations vs. denotations; what /is/ OO, anyway? :-) sincerely. -- You received this messa

Re: Clojure as a 1st language for experienced developer

2009-12-13 Thread dysinger
The 3 major IDEs all have plugins for clojure (InelliiJ IDEA 9 & NetBeans 6.8, Eclipse 3.x) and are free. This might be a good start. There is no "standard" entry point. In the end you will most likely end up on Emacs/Slime if you turn into a lisp nerd. :) I recommend NetBeans w/ Enclojure plu

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Joost
On 13 dec, 08:12, Raoul Duke wrote: > hi, > > > 2. In my mind, the single most important use of OO is polymorphism. > > The ability to associate functions with multiple implementations > > depending on their parameters is very useful since it means you can > > generalize algorithms without having

Re: OnLisp: Porting Chapter 19 to Clojure

2009-12-13 Thread David Nolen
Worked out very quickly but it's headed in the direction you want: (defmacro dynlet [bvec body] `(let ~(if (vector? bvec) bvec (var-get (resolve bvec))) ~body)) (def bds '[a 42]) (dynlet bds (prn a)) (dynlet [a 42] (prn a)) On Sun, Dec 13, 2009 at 5:43 AM, mk wrot

Re: Code introspection: Clojure vs Python

2009-12-13 Thread Konrad Hinsen
On 13 Dec 2009, at 11:18, Dima Dogadaylo wrote: > Is it possible to create a macros that knows from what function it was > called and what variables (bindings) are defined in the caller > function? Yes. Look at the recent thread on debug REPLs: http://groups.google.com/group/clojure/bro

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread ajay gopalakrishnan
Thanks to all, Yes, I am going through the book now and learning the rules of the game. Once I am done with it, I will post on this list, some code (which I will believe to be the Clojure way of doing things) and ask if that seems to be the idiomatic way of doing things. I strongly feel though that

Clojure as a 1st language for experienced developer

2009-12-13 Thread kaveh_shahbazian
I am a C# developer, writing ASP.NET, Windows Applications, managed libraries for 7 years by now. And before that I had done some C/C++. I have never - well; almost never - stepped out of Microsoft world (out of Visual Studio actually) for any big projects and I am not so fluent in things like auto

OnLisp: Porting Chapter 19 to Clojure

2009-12-13 Thread mk
Hi, im just porting Chapter 19 to clojure (my objective is to learn macros). (For those that do not know the book: A database system is introduced that can hold and query painters). It goes nicely until the macro with-answer, which generate bindings on-the-fly so that one can say (with-answer (pa

Code introspection: Clojure vs Python

2009-12-13 Thread Dima Dogadaylo
Is it possible to create a macros that knows from what function it was called and what variables (bindings) are defined in the caller function? For example following python code defines function print_env that prints name of function that called print_env() along with local variables of those func

Re: Leiningen in Python

2009-12-13 Thread Jonghyouk, Yun
Thanks, I'll fix reported those problems, soon :-) Thanks! On 12월13일, 오전7시31분, Rob Wolfe wrote: > Mike K writes: > > All, > > > I tried to use this script on Windows and it blew up real good!  I'm a > > Clojure, Java, and Leiningen newbie, so perhaps a kind soul can help > > me out. > > > 1.  l

Clojure newbie question regarding compile time type checking.

2009-12-13 Thread ajay gopalakrishnan
It tried the following in REPL and got no error. Personally, I feel that I should get an error because calling square on strings is wrong in both cases. Is there a way out of this in Clojure? (defn square [n] (* n n)) (if (= 0 0) (println "hello") (map square ["a" "b"])) The following gives erro

Re: Leiningen Run ?

2009-12-13 Thread mac
On Dec 6, 12:40 am, Phil Hagelberg wrote: > Zach Tellman writes: > > If that's what it takes, great.  Someone just needs to define what a > > multi-platform JNI package looks like. I'm willing to go along with > > whatever is decided upon by technomancy et al. > > I don't think this is necessaril

Re: Generalizing -> & ->>

2009-12-13 Thread Dmitry Kakurin
Thanks for a great idea Andrew! I was slightly annoyed by the lack of consistency in parameter ordering of Clojure collections API (cons vs conj, get/assoc vs filter/ map/take). IMHO the input collection should ALWAYS be the last param. Then simple ->> macro would be sufficient in most cases. Out o

Re: more dumb noob pain ("2dplot.clj")

2009-12-13 Thread Michael Wood
2009/12/13 rebcabin : > I got a lot closer thanks to the great hints above; the current state > is this > > C:\usr\local\bin>java -cp clojure-1.0.0.jar;clojure-contrib.jar;j3d- > core-1.3.1.j > ar;j3dcore-ogl.dll;vecmath.jar;j3dutils.jar;j3dcore-d3d.dll > clojure.lang.Repl By the way, clojure.lang

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Laurent PETIT
And I encourage you to do so: everything that can help bridge the gap between "Java's way of programming things" and "Clojure's way of programming things" will be benefitial to everybody. 2009/12/13 Laurent PETIT > Ajay, > > It seems to me your questions are totally justified. It's a normal reac

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Laurent PETIT
Ajay, It seems to me your questions are totally justified. It's a normal reaction to try to make links between things you know and things you discover. Fortunately, the world doesn't expect you to forget everything you've done in the past in order to try new other things. Your questions, to be an

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-13 Thread Laurent PETIT
Unless I've missed something implicit in your post, why do present us (and particularly ajay, who's trying to understand the language) what I would consider an abuse of macro, where regular functions would do the job very well ? 2009/12/13 mbrodersen > There is nothing "wrong" about objects in C