Re: b:vimclojure_namespace does not exist

2009-10-19 Thread Alex Osborne
I'm not really a vim user, but I just tried this out as I was curious to see what vimclojure was like. It sounds like the nailgun server can't find clojure.jar, try checking the classpath you're using to launch the server. I get the exact same error if I set a bad classpath on purpose. eyeri

Re: b:vimclojure_namespace does not exist

2009-10-19 Thread eyeris
After further investigation, I've determined that it is silently catching an exception in autoload/vimclojure.vim in vimclojure#InitBuffer() around line 668. Commenting out the try/catch/endtry lines gives me the error: "~/devel/xlsmerge/src/xlsmerge/gui.clj" 186L, 6430C Error detected while proc

Re: sequence manipulation question

2009-10-19 Thread Dmitri
ah thanks for the clarification, makes perfect sense, didn't notice into. On Oct 20, 1:25 am, Alex Osborne wrote: > Dmitri wrote: > >  > I notice that certain sequence operations such as concat and cons will >  > not retain the original type of sequence, for example if you combine >  > two vecto

Re: sequence manipulation question

2009-10-19 Thread Alex Osborne
Oops, looks like the end of my message got cut off. Appended below. Alex Osborne wrote: > Dmitri wrote: > > I notice that certain sequence operations such as concat and cons will > > not retain the original type of sequence, for example if you combine > > two vectors together a list will be

Re: Clojure is two!

2009-10-19 Thread ngocdaothanh
Because most materials on Clojure are only at introduction level, I think a "Clojure Cookbook" which provides solutions to many many small real world problems would definitely be a best seller. For most programming languages, I only need 2 books: an introduction one and a cookbook one. On Oct 2

Re: sequence manipulation question

2009-10-19 Thread Alex Osborne
Dmitri wrote: > I notice that certain sequence operations such as concat and cons will > not retain the original type of sequence, for example if you combine > two vectors together a list will be returned: > > user=> (concat [1 2] [3 4]) > (1 2 3 4) > > is this intentional behavior, and wo

sequence manipulation question

2009-10-19 Thread Dmitri
I notice that certain sequence operations such as concat and cons will not retain the original type of sequence, for example if you combine two vectors together a list will be returned: user=> (concat [1 2] [3 4]) (1 2 3 4) is this intentional behavior, and would it not be more consistent for co

Re: Redirecting Output

2009-10-19 Thread Alex Osborne
Gorsal wrote: > I'm trying to redirect the input i receive from a BufferedInputStream > to the repl. I'm trying something like this: > > (defmacro with-thread [nm & body] > `(let [thread# (Thread. (fn [] (do ~...@body)))] > (if ~nm (.setName thread# ~nm)) > (.start thread#) > thread#

Re: Redirecting Output

2009-10-19 Thread Gorsal
oh, and jprint is basically equivalent to print --~--~-~--~~~---~--~~ 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 modera

Redirecting Output

2009-10-19 Thread Gorsal
I'm trying to redirect the input i receive from a BufferedInputStream to the repl. I'm trying something like this: (defmacro with-thread [nm & body] `(let [thread# (Thread. (fn [] (do ~...@body)))] (if ~nm (.setName thread# ~nm)) (.start thread#) thread#)) (defn redirect-stream [nm

Redirecting Output

2009-10-19 Thread Gorsal
I'm trying to redirect the input i receive from a BufferedInputStream to the repl. I'm trying something like this: (defmacro with-thread [nm & body] `(let [thread# (Thread. (fn [] (do ~...@body)))] (if ~nm (.setName thread# ~nm)) (.start thread#) thread#)) (defn redirect-stream [nm

b:vimclojure_namespace does not exist

2009-10-19 Thread eyeris
I've installed the latest VimClojure. I've added to my .vimrc: let g:clj_want_gorilla = 1 let vimclojure#NailgunClient = ".../path/to/ng" au BufRead,Bufnewfile *.clj setfiletype clojure au BufRead,Bufnewfile *.clj setl lisp The ng client is executable. Yet when I open a .clj file, echo b:vimcloj

Re: data structures for efficient range queries

2009-10-19 Thread Timothy Pratley
If the thing you want to index by is not unique, you could do... something like: (def m (atom (sorted-map))) (def rm (atom (sorted-map))) (defn add [k v] (swap! m assoc k v) (swap! rm assoc v (conj (get @rm v []) k))) (add 1 "bbb") (add 2 "ccc") (add 3 "aaa") (add 4 "aaa") ; @rm is now {

Re: data structures for efficient range queries

2009-10-19 Thread Alex Osborne
Alex Osborne wrote: > nchubrich wrote: >> I need to make a data structure for a query such as "find everything >> that is priced $3.27 - $6.12" (and perhaps sum up the total revenue >> for all items in that price range). > > > That's one of the things sorted maps are for: > > (let [objects-by-

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread John Harrop
On Mon, Oct 19, 2009 at 4:05 PM, Danny Woods wrote: > The only thing that I can see that would speed up set-flags would be to not > take the length of the vector on every iteration: I suspect that may involve > a traversal of the vector every time it's called. > With an abstract list/seq that wo

Re: data structures for efficient range queries

2009-10-19 Thread Alex Osborne
nchubrich wrote: > I need to make a data structure for a query such as "find everything > that is priced $3.27 - $6.12" (and perhaps sum up the total revenue > for all items in that price range). That's one of the things sorted maps are for: (let [objects-by-price (sorted-map 0.50 :cookie, 5.0

Re: La Clojure plugin for IntelliJ IDEA moved to Git

2009-10-19 Thread Mark Derricutt
Having this as something like "view javadoc" ctrl-q for java would be good. Also pulling out doc strings and the like would be cool here too (not sure if La Clojure already does this or not). On Tue, Oct 20, 2009 at 12:26 PM, Wilson MacGyver wrote: > Inline it, in essence so you can toggle betwe

Re: data structures for efficient range queries

2009-10-19 Thread Daniel Renfer
Would it be possible to use a hash-map with the prices as the keys and vectors of items as your values? That way you get efficient access to your values if you know the price and aren't paying for the empty space. On Oct 19, 2009 7:23 PM, "nchubrich" wrote: I need to make a data structure for a

Re: data structures for efficient range queries

2009-10-19 Thread Richard Newman
Two simple approaches: 1. Use a sorted, random-access data structure. A vector will suffice. Store your data in this. This is good if your data doesn't change much. Find the extremes of a range by binary search and linear walking. If that's too slow, build a metaindex, which is simply a prec

Re: La Clojure plugin for IntelliJ IDEA moved to Git

2009-10-19 Thread Wilson MacGyver
Inline it, in essence so you can toggle between viewing the code in macro form, or the expanded version. Basically the ability to be able to do (macroexpand) on the fly within the IDE On Mon, Oct 19, 2009 at 5:40 PM, Ilya Sergey wrote: > Wilson, > Do you mean the ability to `view' the macros d

data structures for efficient range queries

2009-10-19 Thread nchubrich
I need to make a data structure for a query such as "find everything that is priced $3.27 - $6.12" (and perhaps sum up the total revenue for all items in that price range). The naive way would be to make an array with one slot for each increment in the entire range, and have each slot pointing to

Re: agents swallowing exceptions?

2009-10-19 Thread Raoul Duke
i don't know what the best solution for everybody is, but the super silent treatment seems like the worst, but that's just me :-} > Perhaps you're suggesting the agents should automatically catch all > their own exceptions and then throw them to stderr. What if you want to > handle them? For de

Re: agents swallowing exceptions?

2009-10-19 Thread Alex Osborne
Raoul Duke wrote: > apparently one has to manually write ones agents to log the exceptions > out to stderr or stdout? i guess my personal principle of least > surprise implementation would have been to at least spit out the first > exception once. The problem is where do you throw the exceptions?

Re: agents swallowing exceptions?

2009-10-19 Thread Raoul Duke
> If any exceptions are thrown by an action function, no nested > dispatches will occur, and the exception will be cached in the Agent > itself. When an Agent has errors cached, any subsequent interactions > will immediately throw an exception, until the agent's errors are > cleared. Agent errors

Re: agents swallowing exceptions?

2009-10-19 Thread Kevin Downey
If any exceptions are thrown by an action function, no nested dispatches will occur, and the exception will be cached in the Agent itself. When an Agent has errors cached, any subsequent interactions will immediately throw an exception, until the agent's errors are cleared. Agent errors can be exa

agents swallowing exceptions?

2009-10-19 Thread Raoul Duke
hello, it seems like when i'm running agent stuff via load-file etc. in the repl, exceptions in fns the agent runs don't appear to be logged anywhere, they are seemingly silently swallowed. personally i find that frustrating. is there some way to make them always verbose / spit out to stdout? or

Re: La Clojure plugin for IntelliJ IDEA moved to Git

2009-10-19 Thread Ilya Sergey
Mark, The issue tracker for La Clojure plugin is now located here: http://youtrack.jetbrains.net/issues/CLJ Wilson, Do you mean the ability to `view' the macros definition without navigating to it, or to `inline' it in place? Cheers! Ilya 2009/10/19 Mark Derricutt > Where should we raise ticke

Re: La Clojure plugin for IntelliJ IDEA moved to Git

2009-10-19 Thread Ilya Sergey
Since the plugin uses embedded compiler to build classes, I'm not sure that this will be working. Unlike Scala plugin, where the compiler is normally taken from libraries, attached to the module, in the case of Clojure, we decided to stick with fixed compiler. But an ability to use a custom compile

Re: Beginner: java.lang.Integer cannot be cast to clojure.lang.IFn (repl)

2009-10-19 Thread Peregrine
Thanks everyone! This seems so obvious now that I look at it. On Oct 19, 10:55 am, Siddhartha Reddy wrote: > The arguments 'n' and 'e' to the calls to findFib on lines 7 and 8 are > enclosed in parens, causing them to be treated as lists. Clojure expects the > first element in a list to be a fun

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Danny Woods
Strangely, I'm not seeing my own emails turn up in this list... Anyways, after re-reading what I sent, it only partially applies :-) The obvious (deliberate, of course) mistake with my vector-of was that I didn't return the vector that I'd built up! So set-flags was, of course, rather fast in

Re: Beginner: java.lang.Integer cannot be cast to clojure.lang.IFn (repl)

2009-10-19 Thread Michael Wood
2009/10/19 Peregrine : > > Hey I am new to Clojure and I am doing some Project Euler problems to > help me get started with the language. I've run into a issue I cannot > seem to get past. I have this code: > > (defn findFib >        "Find the sum of all the even-valued terms in the sequence which

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-19 Thread Meikel Brandmeyer
Hi, Am 19.10.2009 um 01:34 schrieb Dmitry Kakurin: > This is in line with what I was thinking for my own custom filter > function. > Now how would you modify it if the same record can be both "sales" and > "upgrade" at the same time? > I.e. if filters are not mutually exclusive. I'd define a hel

Slime and stuff

2009-10-19 Thread Jeffrey Straszheim
So, I just upgraded my machine to a Macbook Pro, and am reinstalling everything. I'm thinking about using Slime with Aquamacs. Does anyone have a link to a tutorial getting Slime up and running w/ Aquamacs? --~--~-~--~~~---~--~~ You received this message because yo

Side-effect free AOT compilation (Was: Re: Compilation with Java class files)

2009-10-19 Thread Manuel Woelker
On Fri, Oct 16, 2009 at 8:28 AM, Christophe Grand wrote: > Hi, > > On Wed, Oct 14, 2009 at 8:50 PM, Manuel Woelker > wrote: >> >> Hi all, >> >> after digging around a bit in the clojure code, trying to get the >> compile to work, I found out that classes used by the compiled code >> actually cla

Re: ClojureBox not working

2009-10-19 Thread Arie van Wingerden
Put the path to the Java JDK bin directory in the Windows environment variable named PATH: e.g. C:\Program Files\Java\jdk1.6.0_15\bin Create a Windows environment variable named JAVA_HOME containing the path to the Java JDK: e.g. C:\Program Files\Java\jdk1.6.0_15 HTH, Arie 2009/10/17 vi

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Mark Engelberg
This reminds me, is there anything in contrib that works like Scheme's build-vector which works like: (build-vector n f) produces (vec (map f (range n))), i.e., [(f 0) (f 1) (f 2) ... (f (dec n))] ? It would be great if someone's already tested a few variations of this fairly useful function to

Re: Beginner: java.lang.Integer cannot be cast to clojure.lang.IFn (repl)

2009-10-19 Thread Siddhartha Reddy
The arguments 'n' and 'e' to the calls to findFib on lines 7 and 8 are enclosed in parens, causing them to be treated as lists. Clojure expects the first element in a list to be a function and is therefore trying to cast it to an IFn which of course fails. I think this is what you are looking for:

Re: Beginner: java.lang.Integer cannot be cast to clojure.lang.IFn (repl)

2009-10-19 Thread Jarkko Oranen
On Oct 19, 5:52 pm, Peregrine wrote: > Hey I am new to Clojure and I am doing some Project Euler problems to > help me get started with the language. I've run into a issue I cannot > seem to get past. I have this code: > > (defn findFib >         "Find the sum of all the even-valued terms in the

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Stuart Campbell
2009/10/19 Christophe Grand > Hi, > > On Mon, Oct 19, 2009 at 7:59 AM, harto > wrote: > >> I've just started learning Clojure, so I'm trying to figure out the >> correct way of doing things. I've been trying to create and 'modify' a >> large vector for an online programming exercise, but I'm run

Beginner: java.lang.Integer cannot be cast to clojure.lang.IFn (repl)

2009-10-19 Thread Peregrine
Hey I am new to Clojure and I am doing some Project Euler problems to help me get started with the language. I've run into a issue I cannot seem to get past. I have this code: (defn findFib "Find the sum of all the even-valued terms in the sequence which do not exceed four million."

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Stuart Campbell
2009/10/19 Danny Woods > > harto wrote: > > Hello, > > > > I've just started learning Clojure, so I'm trying to figure out the > > correct way of doing things. I've been trying to create and 'modify' a > > large vector for an online programming exercise, but I'm running into > > some performance

Re: Clojure is two!

2009-10-19 Thread Robert Stehwien
> > > >> two more coming. >> >> one is clojure in action, published by manning, written by Amit Rathore >> the other is definitive guide to clojure by Luke VanderHart >> http://www.apress.com/book/view/1430272317 > > > There are two manning books coming out I believe. One by Amit and the > other b

Re: college courses

2009-10-19 Thread artg
I'm using Programming Clojure in a grad course and doing a short Clojure unit in a senior programming languages course at Calif State Univ Long Beach. On Oct 19, 2:19 am, Andreas Wenger wrote: > At the Technische Universität München (Germany), I know of two courses > where Clojure was at least

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Christophe Grand
Hi, On Mon, Oct 19, 2009 at 7:59 AM, harto wrote: > I've just started learning Clojure, so I'm trying to figure out the > correct way of doing things. I've been trying to create and 'modify' a > large vector for an online programming exercise, but I'm running into > some performance issues. > > A

Re: Beginner: performance of vector creation/"modification"

2009-10-19 Thread Danny Woods
harto wrote: > Hello, > > I've just started learning Clojure, so I'm trying to figure out the > correct way of doing things. I've been trying to create and 'modify' a > large vector for an online programming exercise, but I'm running into > some performance issues. > > Any general tips would be ap

Beginner: performance of vector creation/"modification"

2009-10-19 Thread harto
Hello, I've just started learning Clojure, so I'm trying to figure out the correct way of doing things. I've been trying to create and 'modify' a large vector for an online programming exercise, but I'm running into some performance issues. Any general tips would be appreciated! Firstly, I'm cr

Re: Using 'future' ?

2009-10-19 Thread Meikel Brandmeyer
Hi, Am 19.10.2009 um 06:39 schrieb Gorsal: > So now that the future is working, I'm attempting to print from an > actual java thread. Like this > > (defmacro with-thread [nm & body] > `(let [thread# (Thread. #(fn [] (do ~...@body)))] > ~@(if nm `((.setName thread# ~nm))) > (.start thread

Re: Clojure Cheat Sheet

2009-10-19 Thread Ben Mabey
Gorsal wrote: > All right, so this is probably way off topic, but what software was > used to create the clojure cheat sheet? > http://clojure.org/cheatsheet > I really like the format and would like to make one for my own > utilities so that I can actually remember what general utility > function

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-19 Thread Dmitry Kakurin
The reduce-by approach (while cool) would not work for me because I need to run multiple queries on the results. - Dmitry On Oct 18, 10:54 am, Alex Osborne wrote: > Alex Osborne wrote: > > If the three output lists themselves are too large, I'd just explicitly > > sum your units with reduce: >

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-19 Thread Dmitry Kakurin
Thanks Meikel, This is in line with what I was thinking for my own custom filter function. Now how would you modify it if the same record can be both "sales" and "upgrade" at the same time? I.e. if filters are not mutually exclusive. - Dmitry On Oct 18, 8:12 am, Meikel Brandmeyer wrote: > Hi, >

Re: college courses

2009-10-19 Thread Andreas Wenger
At the Technische Universität München (Germany), I know of two courses where Clojure was at least mentioned. This year there was an "advanced Java" seminar with one talk about Clojure ( http://www2.in.tum.de/hp/Main?nid=59 ). Next year there is a "programming models and code generation" seminar w

Re: Dedicated thread for agent or creating thread pool for agent?

2009-10-19 Thread mbrodersen
Good point about the thread pools. I would have preferred to do it in a more platform neutral way but yep that looks like a good solution :-) Thanks Christophe! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cloju

Re: Dedicated thread for agent or creating thread pool for agent?

2009-10-19 Thread Christophe Grand
Hi, On Sun, Oct 18, 2009 at 6:27 AM, mbrodersen wrote: > > I don't know SWT well enough to answer that. I am new to the JVM > platform (after 20+ years of writing native C++ code). > > However, the question is not SWT specific. There will be other cases > (for example OpenGL) where something like