Re: jdbc and postgresql type problem

2011-07-10 Thread Brian Carper
On Jul 10, 4:52 pm, Wilfred wrote: > I'm at a bit of a loss. "UPDATE comments SET approved='1' WHERE id = > '1'" works fine in psql. approved is a boolean field, so is this an > issue with the SQL library producing incorrect SQL? I think this is an oddity with the JDBC driver for PostgreSQL. The

Re: Extending a type to an Interface

2011-07-10 Thread David Jagoe
So the Interface specification has to be available when the record is defined... that makes sense. Thanks Jonathan. On 10 July 2011 14:28, Jonathan Fischer Friberg wrote: > I think the reason is that an interface means that the function must be > 'inside' the class. > I.e you can call (.method ob

Re: jdbc and postgresql type problem

2011-07-10 Thread Sean Corfield
I don't (yet) have a PostgreSQL environment to test java.jdbc on but I'm planning to do that soon. I've also talked to Aaron about how we can set up DBs for automated testing on build.clojure.org so java.jdbc can have "real" tests that I can run locally and which will also still run on the build sy

Re: Local bindings w/o let

2011-07-10 Thread Ken Wesson
On Sun, Jul 10, 2011 at 5:42 PM, octopusgrabbus wrote: > From Clojure api for max > > (defn max >  "Returns the greatest of the nums." >  {:added "1.0"} >  ([x] x) >  ([x y] (if (> x y) x y)) >  ([x y & more] >   (reduce max (max x y) more))) > > Question 1: Why can y be introduced as a local bind

Re: Question on eliminating recur

2011-07-10 Thread FL
On Jul 9, 8:58 am, Christian Marks <9fv...@gmail.com> wrote: > The clojure code below applies the constant space algorithm ... of C. J. Gower ... to the computation of the order of a permutation [Knuth, D. E., “Selected Papers on Analysis of > Algorithms,” CSLI Lecture Notes Number 102, CSLI Pub

Re: Rich Hickey up for deletion

2011-07-10 Thread Devin Walters
http://www.linuxjournal.com/article/10708 and http://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure in combination with http://lambda-the-ultimate.org/node/3630 I'm not entirely clear on all of wikipedia's notability guidelines but these reviews

Re: Local bindings w/o let

2011-07-10 Thread Luc Prefontaine
Lets try to clear the confusion a bit here: (def max1 [x] x) (def max2 [x y] (if (> x y) x y)) (def max3 ([x y & more] (reduce max (max x y) more))) The above a three different fns. max1 has only the arg x. max2 has only x and y and max3 has x and y and maybe other arguments to select the maximu

Re: Local bindings w/o let

2011-07-10 Thread Charlie Griefer
On Sun, Jul 10, 2011 at 4:51 PM, octopusgrabbus wrote: > If the function is called with one argument, what Clojure language > rule allows x to appear outside the vector brackets? ([x] x) The x outside of the vector brackets is the value being returned. So if max is called with only a single arg

jdbc and postgresql type problem

2011-07-10 Thread Wilfred
Hi all I've started a very simple compojure project to wet my feet with Clojure. I've written a simple model changing function: (defn approve! [id] (sql/with-connection db (sql/transaction (sql/update-values :comments ["id = ?" id] {:appr

Re: Native compiler on Clojure

2011-07-10 Thread Matt Hoyt
The JVM does compile to native code once it is executed a specific number of times.  That's what the JIT compiler does.  You can control how many times a piece of code executes before it gets compiled by changing this JVM option -XX:CompileThreshold=. If you want to look at other JVM options yo

Re: Rich Hickey up for deletion

2011-07-10 Thread Alan Malloy
http://www.codequarterly.com/2011/rich-hickey/ ? On Jul 10, 6:26 pm, Michal B wrote: > Rich Hickey's article in Wikipedia is up for deletion again. Does anyone > have links to solid articles about Hickey? -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Rich Hickey up for deletion

2011-07-10 Thread Michal B
Rich Hickey's article in Wikipedia is up for deletion again. Does anyone have links to solid articles about Hickey? -- 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

Re: Local bindings w/o let

2011-07-10 Thread octopusgrabbus
I have another question about max. Is there an advantage if this were re-written with repl? On Jul 10, 7:18 pm, Jonathan Fischer Friberg wrote: > There's no interfaces, that's the function definition. > > define function max > (defn max > > attach docstring > "Returns the greatest of the nums." >

Re: Local bindings w/o let

2011-07-10 Thread octopusgrabbus
If the function is called with one argument, what Clojure language rule allows x to appear outside the vector brackets? On Jul 10, 7:18 pm, Jonathan Fischer Friberg wrote: > There's no interfaces, that's the function definition. > > define function max > (defn max > > attach docstring > "Returns

Re: Local bindings w/o let

2011-07-10 Thread Jonathan Fischer Friberg
There's no interfaces, that's the function definition. define function max (defn max attach docstring "Returns the greatest of the nums." attach metadata {:added "1.0"} if max is called with one argument, use this function definition ([x] x) if max is called with two arguments, use this functi

Native compiler on Clojure

2011-07-10 Thread cran1988
Did anyone started creating native compiler for Clojure language ? -- 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 with y

Re: Local bindings w/o let

2011-07-10 Thread Luc Prefontaine
2) Meta data, max was introduced in V1.0 On Sun, 10 Jul 2011 14:44:16 -0700 (PDT) octopusgrabbus wrote: > For Question 1 this is an example of multiple interfaces. Got it. > > On Jul 10, 5:42 pm, octopusgrabbus wrote: > > From Clojure api for max > > > > (defn max > >   "Returns the greatest o

Re: Local bindings w/o let

2011-07-10 Thread octopusgrabbus
For Question 1 this is an example of multiple interfaces. Got it. On Jul 10, 5:42 pm, octopusgrabbus wrote: > From Clojure api for max > > (defn max >   "Returns the greatest of the nums." >   {:added "1.0"} >   ([x] x) >   ([x y] (if (> x y) x y)) >   ([x y & more] >    (reduce max (max x y) mor

Local bindings w/o let

2011-07-10 Thread octopusgrabbus
>From Clojure api for max (defn max "Returns the greatest of the nums." {:added "1.0"} ([x] x) ([x y] (if (> x y) x y)) ([x y & more] (reduce max (max x y) more))) Question 1: Why can y be introduced as a local binding without a let? Question 2: What is the map {:added "1.0"} doin

Re: Clojure 1.3 Beta 1

2011-07-10 Thread Mark Engelberg
Whoops, I thought I was asking on the dev list, but autocompletion sent it to the regular clojure list. Sorry about that. I'm resending to the dev list. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

Re: Clojure 1.3 Beta 1

2011-07-10 Thread Stuart Sierra
Hi Mark, Please see to http://dev.clojure.org/display/design/Clojure+Contrib To migrate an old clojure-contrib namespace, just ask on the clojure-dev list. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: Extending a type to an Interface

2011-07-10 Thread Jonathan Fischer Friberg
I think the reason is that an interface means that the function must be 'inside' the class. I.e you can call (.method object). Since it isn't possible to extend a java class in that way, it isn't possible to use extend. In a defrecord body however, a new class is defined, which means that it's poss

Re: Question on eliminating recur

2011-07-10 Thread Joost
On Jul 10, 7:15 am, Michael Gardner wrote: > > I think Christian wanted to know *why* one "should" eliminate recur. I can't > think of a reason to avoid it myself, though I also don't recall hearing any > recommendations against using recur. Just my two cents, but the main reason to consider ma

Re: Extending a type to an Interface

2011-07-10 Thread David Jagoe
Thanks for your response Devin. I guess I had come to the same conclusion by the end of my email. But I wonder if there is a more direct way of achieving the same thing without using a macro that spits out a defrecord with in-line method declarations? I had a quick look at the defrecord code and d

Re: comparator that compares collections similar to how strings are compared

2011-07-10 Thread Eugen Dück
Hm, google groups did not show my first reply to myself for a while, and I thought it had gotten lost in the way, so I sent another post, which can be safely ignored, in case anyone wonders what the difference between the first and the second reply is - there is none, fundamentally. On Jul 10, 7:5

Re: comparator that compares collections similar to how strings are compared

2011-07-10 Thread Eugen Dück
Well, turns out string-like-coll-comparator has a bug: x=> (subseq (sorted-map-by string-like-coll-comparator (vec "ab") 1 (vec "n") 2) > (vec "a")) NullPointerException clojure.lang.AFunction.compare (AFunction.java: 59) It can be fixed though: (defn string-like-coll-comparator [coll1 coll2

Re: Discovering a function's closure

2011-07-10 Thread Oded Badt
I see Guess I'm a bit too much used to programming javascript where a function always carries its source around with it - a very very convenient tool in very functional languages where functions are passed along so often anyway, gr8 thanks! Oded On Jul 7, 12:11 pm, Sunil S Nandihalli wro

Re: comparator that compares collections similar to how strings are compared

2011-07-10 Thread Eugen Dück
Well, it can't be the best, because it has a bug. Calling it with "a" instead of "aa" gives me a NPE: x=> (subseq (sorted-map-by string-like-coll-comparator (vec "ab") 1 (vec "n") 2) > (vec "a")) NullPointerException clojure.lang.AFunction.compare (AFunction.java: 59) The following comparator s

Re: Is gensym used for anything except alpha-conversion in macros?

2011-07-10 Thread Luc Prefontaine
No, use it any time you need an arbitrary symbol. On Sun, 10 Jul 2011 10:41:56 +0200 Kazimir Majorinc wrote: > Is gensym used for anything in Clojure except for alpha-conversion in > macros? > -- Luc P. The rabid Muppet -- You received this message because you are subsc

Re: Recommendation for Clojure Enterprise Development toolkit

2011-07-10 Thread Colin Yates
But then how would all the consultants make their money? ;) Sent from my iPad On 10 Jul 2011, at 04:56, Luc Prefontaine wrote: > Hey, if it does not take a year and an army of nuclear scientists to > implement, it would already > be better : > > On Sun, 10 Jul 2011 09:22:18 +0530 > Vivek K

comparator that compares collections similar to how strings are compared

2011-07-10 Thread Eugen Dück
Say I have this sorted map, using strings as keys: x=> (sorted-map "ab" 1 "n" 2) {"ab" 1, "n" 2} When I do a subseq x=> (subseq (sorted-map "ab" 1 "n" 2) > "aa") (["ab" 1] ["n" 2]) I get back both entries. Now if I do the same subseq on the same map, except that I turn all strings into charact

Is gensym used for anything except alpha-conversion in macros?

2011-07-10 Thread Kazimir Majorinc
Is gensym used for anything in Clojure except for alpha-conversion in macros? -- 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 pati