Re: for not returning a lazy sequence

2011-05-20 Thread Jarl Haggerty
I just remembered that people always ask me what version of clojure I'm using, 1.3.0-master-SNAPSHOT. On May 20, 9:41 pm, Jarl Haggerty wrote: > I'm working on problem 66 at project euler and this is my solution so > far.  It calculates the minimum "x"s just fine but takes almost a > minute when

We need a better way to handle errors.

2011-05-20 Thread Ken Wesson
=> (try (doall (map (partial / 36) [4 9 3 2 0])) (catch ArithmeticException _ "boo!")) # The problem with trying to catch exceptions thrown from inside lazy sequence generators is that they all get wrapped in RuntimeException. Catching that works: => (try (doall (map (partial / 36) [4 9 3 2 0]))

for not returning a lazy sequence

2011-05-20 Thread Jarl Haggerty
I'm working on problem 66 at project euler and this is my solution so far. It calculates the minimum "x"s just fine but takes almost a minute when I turn limit up to 20. It's not going to solve the problem fast enough but what I find strange it that if I set the limit to 20 then nothing happens f

Re: clojure.contrib.priority-map issue

2011-05-20 Thread Mark Engelberg
Fixed. Thanks for the bug report. -- 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 your first post. To unsubscribe f

Obfuscating error message with obscure Var corner case

2011-05-20 Thread Ken Wesson
=> (with-local-vars [x 9] (alter-var-root x (fn [_] 3))) # Not the world's clearest error message. I'd prefer something like: # -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a langu

lein usage

2011-05-20 Thread Vincent
Dear all i downloaded lein 1.5.2. ... it does not include clojure.contrib in project.clj when creating a new project. how to do it? Where is detailed documentation for lein? How to know latest version of vairous libs to include in include in lein project.clj Thanks in advace regards Vince

Re: Suggested doc improvements: await

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 8:36 PM, Ken Wesson wrote: > Current doc string: > >  Blocks the current thread (indefinitely!) until all actions >  dispatched thus far, from this thread or agent, to the agent(s) have >  occurred.  Will block on failed agents.  Will never return if >  a failed agent is re

Agent error handlers that throw exceptions themselves

2011-05-20 Thread Ken Wesson
The docs don't say anything about what happens if an agent error handler itself throws an exception, but the answer seems to be: absolutely nothing. => (def a (agent 1)) #'bar/a => (set-error-handler! a (fn [_ err] (if (instance? ArithmeticException err)

Suggested doc improvements: await

2011-05-20 Thread Ken Wesson
Current doc string: Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred. Will block on failed agents. Will never return if a failed agent is restarted with :clear-actions true. What it doesn't note is

Re: Bug? (:refer-clojure ... :as) does not work.

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 7:32 PM, Alan Malloy wrote: > Refer is not use. If you expand the use of set, it boils down to > (require '[clojure.set :as s]) (refer '[clojure.set :exclude > '[difference]]). 1. Refer should still say :as is unsupported if it's unsupported. 2. Refer-clojure is more like

clojure.contrib.priority-map issue

2011-05-20 Thread Adam Ashenfelter
I've been using priority-map from clojure-contrib: https://github.com/clojure/clojure-contrib/blob/master/modules/priority-map/src/main/clojure/clojure/contrib/priority_map.clj Peek and pop don't work as I expected after doing a dissoc for an object not contained in the map. I'm pretty new to C

Re: Bug? (:refer-clojure ... :as) does not work.

2011-05-20 Thread Alan Malloy
Refer is not use. If you expand the use of set, it boils down to (require '[clojure.set :as s]) (refer '[clojure.set :exclude '[difference]]). If you do the same expansion for clojure.core, it works fine: (ns sample (:refer-clojure :exclude [reset!]) (:require [clojure.core :as c])) sample=> c

Bug? (:refer-clojure ... :as) does not work.

2011-05-20 Thread Ken Wesson
=> (ns foo (:refer-clojure :exclude [reset!] :as c)) nil => (def bar (atom [])) #'foo/bar => (reset! bar [42]) # => (c/reset! bar [42]) # => (clojure.core/reset! bar [42]) [42] Contrast with: => (ns bar (:use [clojure.set :exclude [difference] :as s])) nil => (def baz #{1 2 3}) #'bar/baz => (diff

Re: Radically simplified Emacs and SLIME setup

2011-05-20 Thread Phil Hagelberg
On May 19, 11:15 pm, Tassilo Horn wrote: > Do I get you right that the output is the problem that prevents me to > get to the SLIME REPL, since you didn't say anything at all about that > IllegalArgumentException? I'm not sure what's going on with the IllegalArgumentException. Do you have more th

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 2:24 PM, László Török wrote: > On May 20, 2011 7:55 PM, "Fogus" wrote: >> In the alpha7 release the defrecord macro was changed to generate a >> couple of auxiliary functions (for a record R) named map->R and ->R. >> The first takes a map and returns a function of its cont

Re: Clojure stack

2011-05-20 Thread Michael Wood
On 20 May 2011 23:25, Lee Spector wrote: > > On May 20, 2011, at 5:08 PM, Michael Wood wrote: >> >> So maybe the problem you're having is that jEdit can't find the >> clojure.xml mode file? >> > > Not sure, but it does say I'm in Clojure mode... I'm using Mac OS X, BTW... > > It sounds from your o

Re: Clojure stack

2011-05-20 Thread Michael Wood
On 20 May 2011 23:07, Lee Spector wrote: [...] > BTW from what I can tell JEdit doesn't even do reasonable automatic > indentation as you enter code in the first place. If I type "(defn foo" and > hit return the cursor ends up under the second "o" in "foo", and that seems > pretty weird. If I t

RIncater

2011-05-20 Thread Ulises
Hi, Is RIncanter still alive? Cheers, U -- 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 your first post. To unsub

Re: Clojure stack

2011-05-20 Thread Lee Spector
On May 20, 2011, at 5:08 PM, Michael Wood wrote: > > So maybe the problem you're having is that jEdit can't find the > clojure.xml mode file? > Not sure, but it does say I'm in Clojure mode... I'm using Mac OS X, BTW... It sounds from your other descriptions of your own experience like this fa

Re: New to Clojure

2011-05-20 Thread Mark Rathwell
A couple things going on here, I think: First, it looks like maven is having problems communicating with the Woven repositories ("snapshots" " http://mvn.getwoven.com/repos/woven-public-snapshots"; and "releases" " http://mvn.getwoven.com/repos/woven-public-releases";), so it then stops looking in

Re: Clojure stack

2011-05-20 Thread Michael Wood
Hi On 20 May 2011 21:04, Lee Spector wrote: > > To clarify, David, when you say "it just worked" you mean that when you > select Edit > Indent > Indent lines then the line containing the insertion > point is moved (left or right, as appropriate) to conform to standard Lisp > indentation conven

Re: Clojure stack

2011-05-20 Thread Lee Spector
On May 20, 2011, at 3:30 PM, David Nolen wrote: > Ah I thought you were talking about proper automatic indentation as you enter > in code not selective *re-indentation*. As far as I can tell in the existing > Clojure tools there are only varying degrees of interpretation as to what > constitut

Re: New to Clojure

2011-05-20 Thread dudaroo
Thanks Mark... It seems that it is still not resolving correctly though... I changed the line in the project.clj file from: [work "0.2.4-SNAPSHOT"] to [work "0.1.2-SNAPSHOT"] Intuitively, I would've expected to have increased the version number as opposed to changing i

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Fogus
I have a potential fix that handles the extra ->R parameters. However, there are some existing caveats: 1. The 20+ args path is much slower than the <20 args path. This is a limitation that may not go away unless the <20 function args limitation does. The speed difference comes from the ability

Re: Clojure stack

2011-05-20 Thread David Nolen
On Fri, May 20, 2011 at 3:04 PM, Lee Spector wrote: > To clarify, David, when you say "it just worked" you mean that when you > select Edit > Indent > Indent lines then the line containing the insertion > point is moved (left or right, as appropriate) to conform to standard Lisp > indentation con

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Armando Blancas
That's right. Database tables are much flatter than the typical object composition, which you can do after you bring in a tuple into a record. Here's probably where this limitation in Clojure hurts the most, even when tables are fully normalized. On May 20, 11:37 am, pmbauer wrote: > Use Case: Au

Re: Clojure stack

2011-05-20 Thread Lee Spector
To clarify, David, when you say "it just worked" you mean that when you select Edit > Indent > Indent lines then the line containing the insertion point is moved (left or right, as appropriate) to conform to standard Lisp indentation conventions with respect to the code above it (e.g. with resp

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread pmbauer
Use Case: Auto-generated record -> relational mapping? Tables with more than 19 columns is not unheard of. -- 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 a

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread David Nolen
On Fri, May 20, 2011 at 1:55 PM, Fogus wrote: > In the alpha7 release the defrecord macro was changed to generate a > couple of auxiliary functions (for a record R) named map->R and ->R. > The first takes a map and returns a function of its contents. The > second takes the same number of argumen

Re: Clojure stack

2011-05-20 Thread Phil Hagelberg
On May 20, 12:03 am, Ken Wesson wrote: > On Fri, May 20, 2011 at 12:26 AM, michele wrote: > > It's not really the Emacs tools that are a problem, but the huge > > amount of web pages trying - with good intentions - to help you > > installing the Emacs-Clojure stack, but usually lacking some impor

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread László Török
Hi, What's the incremental runtime cost of increasing the max number of fields to 40? :-) Las sent from my mobile device On May 20, 2011 7:55 PM, "Fogus" wrote: In the alpha7 release the defrecord macro was changed to generate a couple of auxiliary functions (for a record R) named map->R and -

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Fogus
In the alpha7 release the defrecord macro was changed to generate a couple of auxiliary functions (for a record R) named map->R and ->R. The first takes a map and returns a function of its contents. The second takes the same number of arguments as the record constructor. It's the definition of thi

Re: New to Clojure

2011-05-20 Thread Mark Rathwell
> Look at the code on github: > http://github.com/clj-sys/work This has moved to: https://github.com/getwoven/work You might also ask the maintainers of this project if they would be able to upload more recent versions to clojars. - Mark

Re: New to Clojure

2011-05-20 Thread Luc Prefontaine
Hi, See my notes below: On Fri, 20 May 2011 10:01:42 -0700 (PDT) dudaroo wrote: > I am trying to help with an existing project and have no developer > notes on the application. I'm trying to use Lein to build the > project.clj project file. > > Within the Clojure build file (named project.clj

Passing "environment configuration parameters" to a Clojure web app

2011-05-20 Thread Laurent PETIT
Hello, I like to have the configuration parameters of my webapps not being bundled in resource files in my webapp(*). So that my webapp can be packaged once and for all for a given version, and not be repackaged for each deployment target. The technique I'm generally using when doing this, which

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Christopher Redinger
On Monday, May 16, 2011 4:42:15 AM UTC-4, Tassilo Horn wrote: > > Is there already a bug report for the hash collisions on protocol > dispatch? > http://dev.clojure.org/jira/browse/CLJ-801 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Re: New to Clojure

2011-05-20 Thread Mark Rathwell
In the clojars repository, looks like the most recent versions are: [work "0.1.2-SNAPSHOT"] http://clojars.org/work [clj-time "0.3.0"] http://clojars.org/clj-time On Fri, May 20, 2011 at 1:01 PM, dudaroo wrote: > I am trying to help with an existing project and have no developer > notes on

New to Clojure

2011-05-20 Thread dudaroo
I am trying to help with an existing project and have no developer notes on the application. I'm trying to use Lein to build the project.clj project file. Within the Clojure build file (named project.clj), the dependencies for the project are specified. Two of the dependencies are developer build

Re: Clojure group in DFW area

2011-05-20 Thread Alex Robbins
I'm planning to be there. Alex -- 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 your first post. To unsubscribe from

Re: Clojure group in DFW area

2011-05-20 Thread ch...@rubedoinc.com
Thanks everyone for attending. Our next meeting is scheduled for Our next meeting is scheduled for May 31th 630PM - 900PM @ Rubedo, inc. 14580 Beltwood Pkwy E Suite 103 Farmers Branch, TX 75244 (wifi available) there will be pizza and sodas, so bring your clojure questions and your appetite.

Re: "clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 10:32 AM, Vincent Liard wrote: > At Fri, 20 May 2011 09:59:35 -0400, > Ken Wesson wrote: > >> The exception is because with-in-str is expecting a single string >> argument, not a binding vector; with-in-str temporarily rebinds *in* >> to read from a string rather than bindi

Re: "clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread Vincent Liard
At Fri, 20 May 2011 09:59:35 -0400, Ken Wesson wrote: > > On Fri, May 20, 2011 at 9:22 AM, Vincent Liard wrote: > > (defn retailer-stock-update [] > >  (wrap-multipart-params > >   (fn [req] > >     (let [xls (get (:params req) "stock-xls")] > >       (with-in-str [str (:bytes xls)] > >         (

Re: Clojure stack

2011-05-20 Thread David Nolen
On Fri, May 20, 2011 at 10:01 AM, Lee Spector wrote: > > On May 20, 2011, at 9:48 AM, David Nolen wrote: > > > > The JEdit mode for Clojure has auto-indenting and bracket matching and it > works just fine for me. If you weren't able to get that to work did you try > contacting the maintainer of th

Re: "clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread Vincent Liard
At Fri, 20 May 2011 09:55:22 -0400, David Nolen wrote: > On Fri, May 20, 2011 at 9:22 AM, Vincent Liard wrote: > [...] >       (with-in-str [str (:bytes xls)] >         (read-xls-stream str)) > > You usage of with-in-str is not correct, you're passing a vector where it > expects a st

Re: Clojure stack

2011-05-20 Thread Lee Spector
On May 20, 2011, at 9:48 AM, David Nolen wrote: > > The JEdit mode for Clojure has auto-indenting and bracket matching and it > works just fine for me. If you weren't able to get that to work did you try > contacting the maintainer of the mode? > Not that I recall but I did mention it in a d

Re: "clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 9:22 AM, Vincent Liard wrote: > (defn retailer-stock-update [] >  (wrap-multipart-params >   (fn [req] >     (let [xls (get (:params req) "stock-xls")] >       (with-in-str [str (:bytes xls)] >         (read-xls-stream str)) > > As far as I have understood, (:bytes xls)

Re: "clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread David Nolen
On Fri, May 20, 2011 at 9:22 AM, Vincent Liard wrote: > (defn retailer-stock-update [] > (wrap-multipart-params > (fn [req] > (let [xls (get (:params req) "stock-xls")] > (with-in-str [str (:bytes xls)] > (read-xls-stream str)) > You usage of with-in-str is not correct, y

Re: Clojure stack

2011-05-20 Thread David Nolen
On Fri, May 20, 2011 at 9:43 AM, Lee Spector wrote: > > I agree that there's a sweet spot for newcomers here, where one uses a > simple REPL (possibly invoked with lein) and an editor that's not tightly > coupled, which should make it easier to provide a unified and idiot-proof > download/install

Re: Clojure stack

2011-05-20 Thread Lee Spector
On May 19, 2011, at 7:43 PM, mike.w.me...@gmail.com wrote: > > The "download the massive IDE" path seems to presume that a newcomer actually > needs something more than "a simple REPL" in order to get started. I'd claim > that's wrong - at least in a world where any computer you'd run clojure o

Re: Clojure stack

2011-05-20 Thread mike.w.me...@gmail.com
Lee Spector wrote: > >On May 19, 2011, at 7:42 PM, Korny Sietsma wrote: > >> Experienced developers (who are likely to grok clojure) probably >already use one of ant / rake / maven / sbt etc. > >"Experienced with what?" is the question. Those coming from the Lisp >world, who are likely both to gr

Re: Clojure stack

2011-05-20 Thread Lee Spector
On May 19, 2011, at 7:42 PM, Korny Sietsma wrote: > Experienced developers (who are likely to grok clojure) probably already use > one of ant / rake / maven / sbt etc. "Experienced with what?" is the question. Those coming from the Lisp world, who are likely both to grok and to be ready to lov

"clojure.lang.PersistentVector cannot be cast to java.lang.String"

2011-05-20 Thread Vincent Liard
Hello, I would like to open an excel file from multipart data without saving it (forbidden by Google Appengine). I have adapted the incanter's read-xls which reads from actual files to read-xls-stream which takes an object of the same kind that with-open provides. I wanted to write something like

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 6:43 AM, Jules wrote: > Looks like a ?bug? has crept into defrecord somewhere - I know that there is > a limit to the number of params that a fn can take, but is it intentional > that the same limit applies to the number of slots that a record can have ? > > [jules@megalodo

Simple thread-safety demo

2011-05-20 Thread Ken Wesson
This short program creates a polymorphic protocol that provides a unified interface for reading and for applying a function to mutable objects and extends it to refs and atoms while creating a Cell type that amounts to a volatile mutable variable. (look thingie) will return the value in all three c

Silent failure of extend-type when used on an array type

2011-05-20 Thread Ken Wesson
The extend-type macro silently fails when used to extend an array type: => eval `(extend-type ~(class (into-array Object [42])) Xfer (look [this#] (aget this# 0)) (mutate* [this# f# args#] (aset this# (apply f# (aget this# 0) args#) 0 nil => (def foo (into-array Object [42])) #'user/foo => (se

Re: Clojure 1.3 Alpha 7

2011-05-20 Thread Jules
Looks like a ?bug? has crept into defrecord somewhere - I know that there is a limit to the number of params that a fn can take, but is it intentional that the same limit applies to the number of slots that a record can have ? : [jules@megalodon dada]$ java -jar ~/.m2/repository/org/clojure/cl

Re: Google Refine

2011-05-20 Thread Ulises
> It's a way older older version of clojure but it's in there.  I've played > around with it. You can always replace the jars (and include others such as support for Jython) and even add contrib. I've done that and it works just fine :) The one grief I had with GRefine is that once you create a c

Re: Clojure stack

2011-05-20 Thread Ken Wesson
On Fri, May 20, 2011 at 12:26 AM, michele wrote: > It's not really the Emacs tools that are a problem, but the huge > amount of web pages trying - with good intentions - to help you > installing the Emacs-Clojure stack, but usually lacking some important > detail. It feels like playing a jig-saw p