Re: Odd error evaling

2011-12-03 Thread N8Dawgrr
Ok not to worry, my environment was bust, a repl restart sorted the issue. On Dec 2, 11:27 pm, N8Dawgrr nathan.r.matth...@gmail.com wrote: Hi Clojurians, I hit the following error today. My environment is Clojure 1.3 (eval (read-string (clojure.repl/source-fn 'keep-indexed)))

Re: running foo.clj no main?? install clojure

2011-12-03 Thread Joost
I run this line java -cp c:/opt/jars/clojure.jar:. clojure.main foo.clj On windows, the java classpath separator is ;, so that should be java -cp c:/opt/jars/clojure.jar;. clojure.main foo.clj I get it can't find clojure.main Doesn't really seem to matter here, but to eliminate

Re: Can't get the debugger cdt run

2011-12-03 Thread Chris Perkins
On Saturday, December 3, 2011 12:16:43 AM UTC-5, Sean Corfield wrote: On Fri, Dec 2, 2011 at 12:37 PM, George Jahad clo...@blackbirdsystems.net wrote: The easiest way to use cdt is from emacs, as described here: http://georgejahad.com/clojure/swank-cdt.html Could you add a note to clarify

Re: Can't get the debugger cdt run

2011-12-03 Thread Edmund
Chris, that's not fatal. Mine works just fine despite the warning. On 03/12/2011 11:29, Chris Perkins wrote: On Saturday, December 3, 2011 12:16:43 AM UTC-5, Sean Corfield wrote: On Fri, Dec 2, 2011 at 12:37 PM, George Jahad clo...@blackbirdsystems.net wrote: The easiest way to use cdt

Re: Can't get the debugger cdt run

2011-12-03 Thread Chris Perkins
I realize now that I just pasted the warning, but I was getting a class loading exception too. I seem to have solved it with this, in my project.clj: :extra-classpath-dirs [/usr/lib/jvm/java-6-sun/lib/tools.jar] I still get the warning, but it works now. Thanks Edmund. - Chris -- You

Re: delayed recursive macro expansion?

2011-12-03 Thread Tassilo Horn
Hi Andrew, your problem is that your recursive macro's termination criterion (no exception thrown for exp) is only there at runtime, but not at macro expansion time. Why don't you use a function here? (defn itry Calls f until it succeeds, querying the user for help. [f] (try (f)

Re: How to attach debugger on clojure's repl ?

2011-12-03 Thread Chris Perkins
On Friday, September 23, 2011 8:00:36 AM UTC-4, Sam Aaron wrote: I'd be very happy to write up a Getting Started tutorial on the ritz wiki if I can get things working. Sam (two months later) Not to publicly shame you or anything, Sam, but... how's that tutorial coming along? :)))

Re: How to attach debugger on clojure's repl ?

2011-12-03 Thread Sam Aaron
On 3 Dec 2011, at 14:03, Chris Perkins wrote: On Friday, September 23, 2011 8:00:36 AM UTC-4, Sam Aaron wrote: I'd be very happy to write up a Getting Started tutorial on the ritz wiki if I can get things working. Sam (two months later) Not to publicly shame you or anything,

Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-03 Thread Gary Trakhman
Have you looked at seesaw? What differences are there in the design and intent? -- 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

Re: How to attach debugger on clojure's repl ?

2011-12-03 Thread Chris Perkins
On Saturday, December 3, 2011 9:50:21 AM UTC-5, Sam Aaron wrote: I never did manage to get ritz working. I believe the issue was with ritz - cake (I still use cake for Overtone hacking). However, now that cake and lein are going to be united, we can just focus on lein support for the

Re: delayed recursive macro expansion?

2011-12-03 Thread Andrew
Aren't the calls to itry-the-fn different from the calls to itry-the-macro? For example, let's say my expr is (/ a b) where b is currently zero and maybe the user decides to set a new value for b when prompted. itry-the-macro can be called this way: (itry (/ a b)) and is able to print out the

Re: A few enhancements

2011-12-03 Thread Stuart Sierra
A matter of curiosity: What are you doing that requires so much symbol manipulation? -S -- 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 -

Re: FYI: problem I had with namespace, defrecord, and import, or Hyphen characters in namespaces considered harmful

2011-12-03 Thread Stuart Sierra
And even that (custom exception classes) should become unnecessary with the almost complete CLJ-733 (data conveying exception). -S -- 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

Re: How to deal with parameters unused by intermediate functions?

2011-12-03 Thread Stuart Sierra
Map destructuring can help here: (defn foo [{:keys [one two] :as args}] (bar args)) (defn bar [{:keys [three]}} ...) (foo {:one 1 :two 2 :three 3}) -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: How to deal with parameters unused by intermediate functions?

2011-12-03 Thread Armando Blancas
If foo is their only caller, bar and baz can be locals inside foo and thus giving baz direct access to foo's params. Checkout (letfn): http://clojuredocs.org/clojure_core/1.2.0/clojure.core/letfn On Dec 2, 7:34 pm, Jim Crossley j...@crossleys.org wrote: Hi, I have a public function foo that

Re: delayed recursive macro expansion?

2011-12-03 Thread Chris Perkins
You should be able to just change your macro to a function, remove the backtick, and change (try ~expr ...) to (try (eval expr) ...). - Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
Hi everyone, I was searching the web these days trying to find out more about these two macro systems and understand their differences, and why one is preferable over the other (or not). I'd like to share with you some ideas, and hopefully get some opinions back as well. Coming from the lisp

Re: Can't get the debugger cdt run

2011-12-03 Thread Sean Corfield
On Sat, Dec 3, 2011 at 3:29 AM, Chris Perkins chrisperkin...@gmail.com wrote: So I guess you didn't get this error then? I did get that warning on my desktop system but CDT worked just fine. user (require '[swank.cdt :as d]) warning: unabled to add tools.jar to classpath. This may cause CDT

Re: How to deal with parameters unused by intermediate functions?

2011-12-03 Thread Jim Crossley
I like that a lot, Stuart, thanks! Named params are a bonus, too: Before I wasn't sure which was on top: (overlay x y pred) Now it's more clear: (overlay :on x :with y :using pred) Thanks again! Jim On Sat, Dec 3, 2011 at 1:03 PM, Stuart Sierra the.stuart.sie...@gmail.comwrote: Map

Re: How to deal with parameters unused by intermediate functions?

2011-12-03 Thread Jim Crossley
Unfortunately, foo is not their only caller, but that's a cool technique I'm sure I'll find a use for. :) Thanks, Jim On Sat, Dec 3, 2011 at 1:05 PM, Armando Blancas abm221...@gmail.com wrote: If foo is their only caller, bar and baz can be locals inside foo and thus giving baz direct access

Using goog.Timer from ClojureScript leads to compile error in advanced mode

2011-12-03 Thread Paul Richards
Hi, I'm using goog.Timer inside my ClojureScript application. When I compile using the non-optimizing cljsc the code compiles and the application works fine. If I try to compile using the optimizing compiler however I get the following error: cljsc hello.cljs '{:optimizations :advanced}'

[ANN] dj-peg released 0.1.0

2011-12-03 Thread Brent Millare
dj-peg 0.1.0 A Ring inspired (aka functional and composable) parsing expression grammar (PEG) library. A while back I wrote a PEG generator. Since it was buggy, I've completely rewritten it and also tried to write it psuedo literate programming (LP) style, in that I try to make it more of a

Re: [ANN] dj-peg released 0.1.0

2011-12-03 Thread Brent Millare
Forgot to post the github link: git://github.com/bmillare/dj-peg.git -- 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

How do I identify Clojars clojure libraries that are 1.3 compatible?

2011-12-03 Thread Tim Robinson
Hello, I'm just starting to upgrade to 1.3 ( I know, I know I should have done this before :) Like many of you, I am using lein, only I'm just starting to update the dependency list. Clojure contrib seems pretty straight forward and documented, but for what about libraries that are found on

Re: Agents vs. Actors

2011-12-03 Thread Benny Tsai
Hi Nils, A while back, I also took a stab* at implementing Erlang-style actors in Clojure, along with solutions for a few classic concurrency problems (Dining Philosophers, Sleeping Barber). I was blown away by how easy it was to implement actor semantics on top of agents. Comparing our

Re: delayed recursive macro expansion?

2011-12-03 Thread Andrew
There's no light on in my attic. It's hollow and dark. :-P (itry (/ 5 0)) == exception (itry (fn [] (/ 5 0))) == #core$eval6242$fn__6243 itf.core$eval6242$fn__6243@3c62e8 But that's ok. I have my ugly macro that uses loop-recur. And I'll be fine. -- You received this message because you are

Re: How do I identify Clojars clojure libraries that are 1.3 compatible?

2011-12-03 Thread Phil Hagelberg
On Sat, Dec 3, 2011 at 11:50 AM, Tim Robinson tim.blacks...@gmail.com wrote: Like many of you, I am using lein, only I'm just starting to update the dependency list. Clojure contrib seems pretty straight forward and documented, but for what about libraries that are found on Clojars? Are they

How would you model this data?

2011-12-03 Thread Base
Hi All, I currently have data stored in a hash-map as follows: (atom { [1 2] value 1, [1 3] value 2, [4 5] value 3 [4 6] value 4 }) I need to identify entries in this map where *either* the first or the second value in the key matches a predicate. (swap! my-map dissoc 1) = { [4 5]

Re: How would you model this data?

2011-12-03 Thread Stephen Compall
On Sat, 2011-12-03 at 13:14 -0800, Base wrote: I need to identify entries in this map where *either* the first or the second value in the key matches a predicate. Unfortunately, you can only have one notion of key equality per map, so you need to either introduce some linear-search component

Re: How would you model this data?

2011-12-03 Thread Linus Ericsson
I don't know what data the vectors depict, but if they are like floating point numbers and you want to do distances etc (like geodata), and need high performance on various strange matchings you should consider something like R-trees http://en.wikipedia.org/wiki/R-tree (or check if there is some

Re: Agents vs. Actors

2011-12-03 Thread Nils Bertschinger
Hi Benny, On Dec 3, 9:21 pm, Benny Tsai benny.t...@gmail.com wrote: Hi Nils, A while back, I also took a stab* at implementing Erlang-style actors in Clojure, along with solutions for a few classic concurrency problems (Dining Philosophers, Sleeping Barber).  I was blown away by how easy it

Re: delayed recursive macro expansion?

2011-12-03 Thread Nils Bertschinger
Hi Andrew, the approach suggested by Tassilo looks correct. Macros are evaluated at compile-time, so you need a termination condition that can be decided without actually running your form. In you're case you want run-time delayed evaluation, which is easily achieved by wrapping the expression

Re: Clojure + Java Interop + Gnome Interop -- KeyPressEvent fails

2011-12-03 Thread Henrik Lundahl
Hi Rett There is no such type as org.gnome.gtk.Window$**KeyPressEvents, at least not in 4.1 of the Java Gnome APIhttp://java-gnome.sourceforge.net/doc/api/4.1/org/gnome/gtk/Window.html . org.gnome.gtk.Window$**KeyPressEvent exists though. I'd guess you have a typo somewhere, perhaps in the

Re: How to deal with parameters unused by intermediate functions?

2011-12-03 Thread Brian Goslinga
In rare cases using vars + binding may be a good solution, although your functions become impure and there can be interesting interactions with laziness. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: delayed recursive macro expansion?

2011-12-03 Thread Brian Goslinga
1) Write itry-fn which takes a function and the source of the function. Example usage: (itry-fn (fn [] (/ 5 0)) '(/ 5 0)) 2) Next write your itry macro to use the function: (defmacro itry [expr] `(itry-fn (fn [] ~expr) '~expr)) A general rule of thumb for macros is that they should provide

Re: on lisp and scheme macros

2011-12-03 Thread Stuart Sierra
I think that Common Lisp macros are, strictly speaking, more powerful than Scheme macros, but I don't have a citation. -S -- 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

Re: on lisp and scheme macros

2011-12-03 Thread Tassilo Horn
Stuart Sierra the.stuart.sie...@gmail.com writes: I think that Common Lisp macros are, strictly speaking, more powerful than Scheme macros, but I don't have a citation. Let over Lambda is essentially a huge essay about why there's and will never be anything as powerful than the CL macro

Re: on lisp and scheme macros

2011-12-03 Thread Peter Danenberg
This talk of Scheme macros is a little weird: are we talking syntax-case, explicit-renaming, or unhygienic defmacro? Scheme has them all. There are also implementation-specific mechanisms for writing reader macros: what's left? On Dec 3, 2011, at 14:57, Stuart Sierra

Re: on lisp and scheme macros

2011-12-03 Thread Scott Jaderholm
Scheme style macros in Clojure: https://github.com/qbg/syntax-rules Scott On Sat, Dec 3, 2011 at 1:20 PM, Razvan Rotaru razvan.rot...@gmail.comwrote: Hi everyone, I was searching the web these days trying to find out more about these two macro systems and understand their differences, and

Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-03 Thread Stathis Sideris
Hello Gary, Hello Gary, To be honest I didn't look at seesaw much while developing Clarity, so I didn't make any conscious decision to differentiate with seesaw. It's very interesting to see that both me and Dave Ray came up with similar solutions/features. It seems that Seesaw is more concise

Re: The Clojure way to solve this problem?

2011-12-03 Thread AndyK
Thank you - that worked brilliantly. I'm using a Java load testing tool called The Grinder and it has an instrumented HTTP library that is dependent on running within The Grinder. So I have clj-http for developing my tests and then I can drop them into load testing and substitute the Grinder using

Re: on lisp and scheme macros

2011-12-03 Thread Marek Kubica
On Sun, 04 Dec 2011 00:08:36 +0100 Tassilo Horn tass...@member.fsf.org wrote: Stuart Sierra the.stuart.sie...@gmail.com writes: I think that Common Lisp macros are, strictly speaking, more powerful than Scheme macros, but I don't have a citation. Let over Lambda is essentially a huge

Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-03 Thread Dave Ray
Howdy, I'll clarify some of Stathis' remarks about Seesaw below. Obviously, I'm a little biased, but Clarity looks cool and I plan on borrowing some of its features for Seesaw in the next release or two :) I think it's great to have multiple projects like this to inspire each other and keep

Re: on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
Wow. I didn't thought this was possible. You know, I have seen a lot of people saying that scheme macros are more powerfull, citing the fact that scheme also has lisp macros, while it's not possible to do it the other way around. On Dec 4, 2:06 am, Scott Jaderholm jaderh...@gmail.com wrote: