Re: how to use with-bindings*

2010-02-14 Thread Meikel Brandmeyer
Hi, On Feb 15, 6:49 am, Аркадий Рост wrote: > ok...Then what was the reason to use map instead of vector as usually? with-bindings* is a low-level function. It pushes the given map of var/ values onto the stack of thread local bindings and takes care to remove it correctly after the given funct

leiningen powershell script

2010-02-14 Thread Brian Wolf
Hi, I am trying to run( http://bit.ly/82zo95 ) powershell script for leiningen install under windows, but it says it can't find file, which file it doesn't say. I was wondering what dependencies leiningen has? Do I need maven pre- installed (I don't see anything

Re: Question about how I got run?

2010-02-14 Thread ataggart
On Feb 14, 6:47 pm, Mike Meyer wrote: > So, the next question - possibly another name-space question. > > Is there any way to tell if inside a .clj file if it was invoked as a > script by clojure.main, vs. being loaded for use elsewhere? No. > > What I'd like to do is make my unit tests usabl

Re: processing two collections

2010-02-14 Thread ataggart
On Feb 14, 5:49 pm, Glen Rubin wrote: > Thank you for the advice!  Just for reference I am working on project > euler question #4 (Find the largest palindrome made from the product > of two 3-digit numbers.) > > I have a solution, but am hoping somebody can clarify some things for > me: > > Firs

Re: how to use with-bindings*

2010-02-14 Thread Аркадий Рост
ok...Then what was the reason to use map instead of vector as usually? -- 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 Note that posts from new members are moderated - please be patient wit

Re: how to use with-bindings*

2010-02-14 Thread Michał Marczyk
(with-bindings* {#'a 3} println a) with-bindings* expects the keys of the bindings map to be Vars, not symbols. Sincerely, Michał -- 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 Note that

how to use with-bindings*

2010-02-14 Thread Аркадий Рост
Hi! I was playing a bit with with-bindings* function, but I got error every time. I've tried: (def a 5) (with-bindings* {a 3} println a) ;; got java.lang.Integer cannot be cast to clojure.lang.Var (with-bindings* [{a 3}] println a) ;;got clojure.lang.PersistentArrayMap cannot be cast to clojure

Question about how I got run?

2010-02-14 Thread Mike Meyer
So, the next question - possibly another name-space question. Is there any way to tell if inside a .clj file if it was invoked as a script by clojure.main, vs. being loaded for use elsewhere? What I'd like to do is make my unit tests usable in two modes: While working on a bug, I'd like to be abl

Re: ClojureCLR under slime / emacs?

2010-02-14 Thread Terje Norderhaug
On Feb 14, 2010, at 7:43 AM, Shawn Hoover wrote: On Sat, Feb 13, 2010 at 11:43 PM, Mike K wrote: Does anyone have ClojureCLR running under emacs via slime? Failing that, can anyone give me some pointers as to how I might hacking swank-clojure.el (or whatever) to get this to work? Mike Hi Mi

Swank Clojure [Re: clojure-dev: #55]

2010-02-14 Thread Terje Norderhaug
On Feb 13, 2010, at 5:19 PM, wilig wrote: I'm willing to give maintenance of swank-clojure a shot. With one huge caveat: I'm very new to both clojure and CL, so patience will have to be practiced as I slowly get up to speed on a new code base in a new language. Unless anyone with more experienc

Swank Clojure [Re: clojure-dev: #55 ...]

2010-02-14 Thread Terje Norderhaug
On Feb 13, 2010, at 3:22 PM, Phil Hagelberg wrote: I should mention that I could use some help co-maintaining swank-clojure. I don't feel like I have a great grasp on the codebase right now and have just been keeping it on autopilot after figuring out packaging issues, but having someone who's fa

Re: What is a form, exactly? + Are there any guarantees about the return types of quote and syntax-quote?

2010-02-14 Thread Garth Sheldon-Coulson
Okay, Michal, I see what you mean. Let me revise my first question, then, to replace "form" with "expression," where by expression I mean a form whose first element will be called as a function when the form is passed to eval. (Revised version: What characterizes an expression? Is it correct to s

Re: processing two collections

2010-02-14 Thread Glen Rubin
Thank you for the advice! Just for reference I am working on project euler question #4 (Find the largest palindrome made from the product of two 3-digit numbers.) I have a solution, but am hoping somebody can clarify some things for me: First, I define a panlindrome tester: (defn palindrome? [s

Re: What is a form, exactly? + Are there any guarantees about the return types of quote and syntax-quote?

2010-02-14 Thread Michał Marczyk
A post scriptum: On 15 February 2010 02:31, Michał Marczyk wrote: > As far as I can tell, Clojure's eval will accept basically any sort of > object as a form, with things for which no special behaviour is > defined taken to be self-evaluating. That seems to be the usual > behaviour for a Lisp dia

Re: Help! Clojuresque build failed

2010-02-14 Thread sailormoo...@gmail.com
Thanks for the help. I still cannot build it in Windows, but I just download the ClojureQL 0.9.7 from clojars. -- 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 Note that posts from new membe

Re: What is a form, exactly? + Are there any guarantees about the return types of quote and syntax-quote?

2010-02-14 Thread Michał Marczyk
On 15 February 2010 02:02, Garth Sheldon-Coulson wrote: > If it's correct to say that a form is always something for which seq? > returns true and never something for which seq? returns false, [...] The traditional Lisp view would be that *anything* that can be passed to eval is a form, cf. Commo

What is a form, exactly? + Are there any guarantees about the return types of quote and syntax-quote?

2010-02-14 Thread Garth Sheldon-Coulson
Hi Everyone, The set of classes for which seq? returns true is rather large. It contains Cons, LazySeq, PersistentList, and many others. Experimentation reveals that any of these types can be used to hold Clojure code for evaluation by eval. Is a form just anything for which seq? returns true, by

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread wilig
> 1) *err* and *out* promise to implement java.io.Writer in the > documentation not java.io.PrintWriter. Calling .println on *out* or > *err* is not appropriate. Actually this was the impetus for my change to the swank-clojure. I still vastly prefer Richards implementation to mine, but I though

Re: deftype comment

2010-02-14 Thread Mark Engelberg
Actually, the more I think about it, the more I feel like deftype's "specify clojure.lang.IPersistentMap as an interface with no implementation, and you'll get a default implementation" seems like a weird exception, and I can't help but wonder if there's a more general way to handle it that would h

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Richard Newman
Why log anything at all? The relevant information is (or can be) stored in the exception. I don't want to see clojure contrib embrace the catch/log/re-throw idiom. I couldn't find any other code in contrib that follows this approach. Ain't my code. I was simply saying I prefer libraries to pr

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Jason Samsa
> > 2) c.c.sql shouldn't assume that we want anything printed at all?! > > Just throw the SQLException. > > Printing to *err* is acceptable IMO. This is the common "should my   > library write log messages, and if so how?" problem. I'd rather have   > it print to *err* than use Java Logging. > Why

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Jason Samsa
I would like to create a patch to address the issues above and get the c.c.sql tests running under clojure.test. I should have a patch ready by the end of the day. I've just filled out my contributor agreement it'll be in the mail tomorrow. Jason -- You received this message because you are su

Re: deftype comment

2010-02-14 Thread Mark Engelberg
On Sun, Feb 14, 2010 at 8:56 AM, Stuart Sierra wrote: > Rich's stated reason against this is that he wants to be able, some > day, to implement maps and map-like things with deftype. Hmmm, if so, then there's a bit of a design tension between that goal and the goal of "prefer deftype to defstruct

Re: contrib.sql with postgresql is really a problem

2010-02-14 Thread Richard Newman
My first problem was to save a timestamp value. I defined a field in pgsql as "timestamp" and wasn't able to store a simple timestamp value because I got type mismatch errors and it also displayed the statement which I could copy and execute successfully in pgadmin which confused me a lot. I see

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Richard Newman
Patching swank might be appropriate but doesn't address several incorrect assumptions made by c.c.sql: 1) *err* and *out* promise to implement java.io.Writer in the documentation not java.io.PrintWriter. Calling .println on *out* or *err* is not appropriate. I started in the same mental place

Re: small code review..

2010-02-14 Thread Meikel Brandmeyer
Hi, On Sun, Feb 14, 2010 at 08:32:42AM -0800, Martin Hauner wrote: > > (cond > >   (empty? rolls)     0 > >   (strike? rolls)    (+ (score-strike rolls) (score-after-strike rolls)) > >   (spare?  rolls)    (+ (score-spare rolls)  (score-after-frame rolls)) > >   (more?   rolls)    (+ (score-frame

Re: small code review..

2010-02-14 Thread Martin Hauner
On 12 Feb., 01:34, Timothy Pratley wrote: > On 12 February 2010 03:19, Martin Hauner wrote: > > > I'm mostly interested if there is anything in my code one would/should > > never do that way. > > Looks excellent, you've aced it! Thanks :-) > I'd like to discuss switching...You wrote: > > (cond

Re: small code review..

2010-02-14 Thread Martin Hauner
Hi Brandon, On 11 Feb., 19:59, Brenton wrote: > Martin, > > It's very simple, I like it. > > There two things that stand out to me, both having to do with > readabiliby. > > Instead of using (def score) you should use (declare score). declare > exists for the purpose of making forward declaration

Re: Interest in Google Summer of Code 2010?

2010-02-14 Thread Vivek Khurana
On Feb 14, 11:27 am, Vivek Khurana wrote: >  I had moved to Clojure recently. I had been GSoC mentor twice and I > have the t-shirt to prove it ;-) . If clojure is accepted in GSoC, I > will be happy to co-mentor some student. I cant be full blown mentor > as I am only 4 months old in clojure wo

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Jason Samsa
Patching swank might be appropriate but doesn't address several incorrect assumptions made by c.c.sql: 1) *err* and *out* promise to implement java.io.Writer in the documentation not java.io.PrintWriter. Calling .println on *out* or *err* is not appropriate. 2) c.c.sql shouldn't assume that we

Re: A couple of namespace questions

2010-02-14 Thread Stuart Sierra
On Feb 14, 2:09 am, Mike Meyer wrote: > Second, is there a way to refer to a relative namespace? Not as such, but the 'load' function uses the parent directory of the current namespace: (ns foo.bar.baz (:load "quux")) ;; => loads foo/bar/baz.clj and foo/bar/quux.clj (ns foo.bar.baz (:load "

Re: processing two collections

2010-02-14 Thread Stuart Sierra
On Feb 14, 9:57 am, Glen Rubin wrote: > How do I take an element from one collection and test for no remainder > (e.g. (zero? (mod x y)), when dividing by every element of the second > collection, before processing the next item in the first > collection? The 'for' macro does this. -SS -- You

Re: deftype comment

2010-02-14 Thread Stuart Sierra
On Feb 14, 1:53 am, Mark Engelberg wrote: > I think it would be ideal that if you *don't* > specify clojure.lang.IPersistentMap as an interface, you still get an > implementation of assoc that works only with keys already in the type. ... > Thoughts? Rich's stated reason against this is that he w

Re: ClojureCLR under slime / emacs?

2010-02-14 Thread Stuart Sierra
On Feb 14, 10:43 am, Shawn Hoover wrote: > The real work would be in the swank-clojure clj sources. Yes, you would basically have to rewrite swank-clojure, as it depends heavily on the JDK socket libraries. -SS -- You received this message because you are subscribed to the Google Groups "Clojur

Re: processing two collections

2010-02-14 Thread Steven E. Harris
Glen Rubin writes: > How do I take an element from one collection and test for no remainder > (e.g. (zero? (mod x y)), when dividing by every element of the second > collection, before processing the next item in the first collection? This form checks if every element of the second range is a fa

Re: ClojureCLR under slime / emacs?

2010-02-14 Thread Shawn Hoover
On Sat, Feb 13, 2010 at 11:43 PM, Mike K wrote: > Does anyone have ClojureCLR running under emacs via slime? > > Failing that, can anyone give me some pointers as to how I might > hacking swank-clojure.el (or whatever) to get this to work? > > Mike Hi Mike, I've not heard of anyone doing thi

Re: Interest in Google Summer of Code 2010?

2010-02-14 Thread Vivek Khurana
On Feb 13, 8:19 pm, defn wrote: > Hello all, > > Is there any interest in GSoC 2010 for Clojure? I posted a reply yesterday but for some reasons it has not appeared yet. So posting again. I had moved to Clojure recently. I had been GSoC mentor twice and I have the t-shirt to prove it ;-) . If

contrib.sql with postgresql is really a problem

2010-02-14 Thread schipplock
Hi, I'm playing around with contrib.sql for the last few days and I was quite enthusiastic about it but for now I'm struggling with problems I encountered in no other language before. My first problem was to save a timestamp value. I defined a field in pgsql as "timestamp" and wasn't able to store

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread wilig
I'm willing to give maintenance of swank-clojure a shot. With one huge caveat: I'm very new to both clojure and CL, so patience will have to be practiced as I slowly get up to speed on a new code base in a new language. Unless anyone with more experience wants to jump in, I will begin applying pa

Re: Interest in Google Summer of Code 2010?

2010-02-14 Thread Vivek Khurana
On Feb 13, 8:19 pm, defn wrote: > Hello all, > > Is there any interest in GSoC 2010 for Clojure? I moved to clojure recently. I had been GSoC mentor twice and i have the t-shirt to prove it ;-) I am willing to be a co-mentor in case clojure is accepted in GSoC. I cant take up full mentor role

Re: processing two collections

2010-02-14 Thread Meikel Brandmeyer
Hi, On Sun, Feb 14, 2010 at 06:57:41AM -0800, Glen Rubin wrote: > howdy clojure folks! I am a noob and trying to do the following: > > Suppose I have 2 collections of numbers: > > (range 1000 2000) (range 100 150) > > > How do I take an element from one collection and test for no remainder >

Re: First program, in case you want to give hints

2010-02-14 Thread Johnny Kwan
On Feb 14, 2010, at 8:58 AM, Laurent PETIT wrote: > 2010/2/14 alux : >> Hello Sean, >> >> thank you for the answer. >> >> I used letfn not for recursive swearing, but for the localness. I >> thought the functions to be so special, >> nobody else will use it, so I put it into conway-PM. Is there

processing two collections

2010-02-14 Thread Glen Rubin
howdy clojure folks! I am a noob and trying to do the following: Suppose I have 2 collections of numbers: (range 1000 2000) (range 100 150) How do I take an element from one collection and test for no remainder (e.g. (zero? (mod x y)), when dividing by every element of the second collection, b

Re: First program, in case you want to give hints

2010-02-14 Thread Laurent PETIT
2010/2/14 alux : > Hello Sean, > > thank you for the answer. > > I used letfn not for recursive swearing, but for the localness. I > thought the functions to be so special, > nobody else will use it, so I put it into conway-PM. Is there a non > recursive let for functions? Hello, in this case, yo

Re: First program, in case you want to give hints

2010-02-14 Thread alux
Hello Sean, thank you for the answer. I used letfn not for recursive swearing, but for the localness. I thought the functions to be so special, nobody else will use it, so I put it into conway-PM. Is there a non recursive let for functions? Thanks for the hint about Lisppaste, didnt know that.

Re: Permutations of n things

2010-02-14 Thread Steve Purcell
On 14 Feb 2010, at 13:20, ka wrote: > I'm trying to make a function which gives the n! permutations of a > vector of n things. Here is my first attempt : > > (defn permute > "Gives the n! permuations of the input vector of things" > [v] > (if (= 1 (count v)) (list [(v 0)]) >(loop [i 0 perm

Permutations of n things

2010-02-14 Thread ka
I'm trying to make a function which gives the n! permutations of a vector of n things. Here is my first attempt : (defn permute "Gives the n! permuations of the input vector of things" [v] (if (= 1 (count v)) (list [(v 0)]) (loop [i 0 perm '()] (if (= i (count v)) perm

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Steve Purcell
On 14 Feb 2010, at 09:34, Steve Purcell wrote: > In my master branch (freshly forked from Phil's repo) I've applied Richard's > patch, plus the following recent branches from the swank-clojure network on > github (http://github.com/technomancy/swank-clojure/network): I should add that I skipp

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Steve Purcell
On 13 Feb 2010, at 23:22, Phil Hagelberg wrote: > Even without CL experience, just > gathering up the various patches into one branch and seeing what works > and what doesn't would be very helpful too. I'll bite: http://github.com/purcell/swank-clojure In my master branch (freshly forked fro

Re: deftype comment

2010-02-14 Thread Konrad Hinsen
On 14.02.2010, at 07:53, Mark Engelberg wrote: > After playing around, I think it would be ideal that if you *don't* > specify clojure.lang.IPersistentMap as an interface, you still get an > implementation of assoc that works only with keys already in the type. > In other words, you can't add a ne