Re: RFC on my letrec macro

2010-07-23 Thread George Jahad
sorry, wrong gist. here's one that tests for a function and only calls trampoline on it. all three of your test cases work for it. http://gist.github.com/487019 g On Jul 22, 10:50 pm, Michał Marczyk michal.marc...@gmail.com wrote: On 23 July 2010 06:50, George Jahad

Re: Slime, debug-repl clojure debugging toolkit

2010-07-23 Thread Krukow
On Jul 23, 6:19 am, George Jahad cloj...@blackbirdsystems.net wrote: [snip] as i explained above you have to use swank/break with case 3. in addition to these 4 cases, it sounds like you are having a problem viewing the local java object, which is why i suggested using the vanilla

Re: [ccw-users] CCW in Eclipse Market Place + needs a logo !

2010-07-23 Thread Laurent PETIT
2010/7/22 Konrad Hinsen konrad.hin...@fastmail.net On 22 Jul 2010, at 13:09, Laurent PETIT wrote: But we need a logo ! If there's an area where I dooon't shine at all, it's graphics. Me neither, but here is an idea: start from the nicely circular Clojure logo and add a circular arrow

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-23 Thread Zmitro Lapcjonak
On Jul 20, 10:02 pm, Laurent PETIT wrote: that'll bit anybody from time to time ( after having spent 15 minutes understanding why this doesn't work anymore: OH YES, I have forgotten to synchronize the REPL ...) thus i do enter nothing in the CCW repl. all code, both business logic and all

Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Rising_Phorce
I'm coming from an imperative background and trying to stay away from for loops to do the task at hand. Given a size, I want to create a vector of vectors to represent a game board similar to Rich's ants or Conway's Game of Life (no wrapping necessary for me). A couple of questions. I will need

Re: Memoizing a recursive function?

2010-07-23 Thread logan
I tried defn-memo .. it still does not appear to memoize the original fib call? I tried this using clojure 1.2 beta. Reading the code definition for defn-memo it seems like it should work, but calling (fib 41) still takes a long time after calling (fib 40), when it should basically be an

Re: Memoizing a recursive function?

2010-07-23 Thread logan
paul what version did you use? your version was the first one I tried, and on 1.2 at least it does not work. Jules version works, except lambda should be fn in clojure. On Jul 22, 4:51 pm, Paul Mooser taron...@gmail.com wrote: Why not simply do: (defn fib [n]   (println called with n)  

Re: CCW in Eclipse Market Place + needs a logo !

2010-07-23 Thread Victor S
I can send you something, but I don't know how to attach files here... - V On Jul 22, 7:09 am, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, Just a word to inform you that I've provisioned the Eclipse Market Place for Counterclockwise. That way, installing counterclockwise from

Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-23 Thread Victor S
I finally got labrepl to work with one IDE, tried with intelliJ but didnt work, also comand line didnt work on mac os x. But Eclipse version seems to work! Yay! So I can't wait to start learning more about Clojure, but the road so far is pretty bumpy... Any help in figuring out what this log4j

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Edmund Jackson
Hi, Some time back Lau Jensen blogged something like this. Its starts here http://www.bestinclass.dk/index.clj/2009/10/brians-functional-brain.html but there are at least two follow ups. It might spark inspiration if you've not yet read it. Edmund On 22 Jul 2010, at 13:37,

Re: Memoizing a recursive function?

2010-07-23 Thread Meikel Brandmeyer
Hi, On Jul 23, 3:02 am, logan duskli...@gmail.com wrote: paul what version did you use? your version was the first one I tried, and on 1.2 at least it does not work. It works on 1.1. I guess there is some issue with the direct linking introduced in 1.2. Sincerely Meikel -- You received

Re: Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-23 Thread Laurent PETIT
And may I add that crazy easy labrepl installation for ccw is around the corner: http://github.com/smuehlst/ccw/tree/labrepl-sample-project ! 2010/7/23 Victor S victor.s...@gmail.com I finally got labrepl to work with one IDE, tried with intelliJ but didnt work, also comand line didnt work on

Re: Memoizing a recursive function?

2010-07-23 Thread Laurent PETIT
Yes, because the code I posted still makes me wonder what's happening ... 2010/7/23 Meikel Brandmeyer m...@kotka.de Hi, On Jul 23, 3:02 am, logan duskli...@gmail.com wrote: paul what version did you use? your version was the first one I tried, and on 1.2 at least it does not work. It

Re: CCW in Eclipse Market Place + needs a logo !

2010-07-23 Thread Laurent PETIT
Via this ml google group's web interface, there's a file section 2010/7/23 Victor S victor.s...@gmail.com I can send you something, but I don't know how to attach files here... - V On Jul 22, 7:09 am, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, Just a word to inform you that

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-23 Thread Lee Spector
I too often use a file as a pseudo-REPL in this way, but note that this means putting top-level forms in the file, which is apparently discouraged, and in the context of CCW's default setting of rebuild-on-save will cause your top-level forms to be re-evaluated each time you save (which you

contrib deprecations and removals

2010-07-23 Thread Stuart Halloway
Hi all, Aaron and I are spending the day cleaning up contrib, starting with marking deprecations in the 1.2 branch. The approach we are taking is (1) Things are deprecated for one full (minor version number) release (in this case 1.2). (2) Then things may (and in contrib usually will) be

Re: Memoizing a recursive function?

2010-07-23 Thread Mike Meyer
[Context lost to top posting.] On Thu, 22 Jul 2010 15:56:32 -0700 (PDT) logan duskli...@gmail.com wrote: I tried defn-memo .. it still does not appear to memoize the original fib call? I tried this using clojure 1.2 beta. Reading the code definition for defn-memo it seems like it should work,

Re: Slime, debug-repl clojure debugging toolkit

2010-07-23 Thread Hugo Duncan
On Fri, 23 Jul 2010 02:35:13 -0400, Krukow karl.kru...@gmail.com wrote: So I guess the problem is in swank/break. Should be fixed in 1.3.0-SNAPSHOT now. -- Hugo Duncan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Konrad Hinsen
On 22 Jul 2010, at 14:37, Rising_Phorce wrote: I will need to traverse the vectors sequentially but at each step there will be lots of sequential back and forward tracking. Arrays would be the natural imperative choice, but the docs recommend this only for inter-op. So are vectors the best

Re: RFC on my letrec macro

2010-07-23 Thread George Jahad
Just realized there are many types of recursive functions for which trampoline can't be used in this way. It's an interesting problem though. I'm going to think some more about it. On Jul 22, 11:11 pm, George Jahad cloj...@blackbirdsystems.net wrote: sorry, wrong gist.  here's one that tests

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Meikel Brandmeyer
Hi, On Jul 23, 4:19 pm, Konrad Hinsen konrad.hin...@fastmail.net wrote: Instead of (take size (repeat nil)), you can write (replicate size   nil). You can then make a square board filled with nils with Or just (repeat size nil). I think replicate was replaced by the two- arg form of repeat.

Re: ANN: clj-dropbox, Dropbox client library in Clojure

2010-07-23 Thread Marc Spitzer
I need to look at this. Thanks for the toy. marc On Thu, Jul 22, 2010 at 8:23 PM, aria42 ari...@gmail.com wrote: Hi all, I've released my clojure library for accessing the Dropbox API. Its called clj-dropbox and it can be found at: http://github.com/aria42/clj-dropbox Hope some people

New git repo for enclojure-repl

2010-07-23 Thread Eric Thorsen
There has been interest in reusing some of the features of the Enclojure repl tools outside of Netbeans or swing. I have created a separate repo to help the effort in moving in that direction. http://github.com/EricThorsen/enclojure-repl Eric -- You received this message because you are

Re: New git repo for enclojure-repl

2010-07-23 Thread Laurent PETIT
Yepee ! 2010/7/23 Eric Thorsen ethor...@enclojure.org There has been interest in reusing some of the features of the Enclojure repl tools outside of Netbeans or swing. I have created a separate repo to help the effort in moving in that direction.

Re: Slime, debug-repl clojure debugging toolkit

2010-07-23 Thread Krukow
On Jul 23, 3:59 pm, Hugo Duncan hugodun...@users.sourceforge.net wrote: On Fri, 23 Jul 2010 02:35:13 -0400, Krukow karl.kru...@gmail.com wrote: So I guess the problem is in swank/break. Should be fixed in 1.3.0-SNAPSHOT now. -- Hugo Duncan I've verified that it works here. Thanks for

Idea - generic conversion multimethod

2010-07-23 Thread Adam Schmideg
Hi, I want to share an idea I've been playing with recently. I noticed I want to convert between different representations of roughly the same value every now and then, string to number, a var to symbol and vice versa, even a filename to an open stream. There are two approaches in the language.

filtering with multiple predicates

2010-07-23 Thread .Bill Smith
I want to filter a list based on the logical AND of a set of predicates. For example, let's say I have single-argument functions f, g, and h (without side-effects), and I want those items x in the list such that (f x), (g x) and (h x) are all true. I know I can do this: (filter #(and (f %) (g

Re: filtering with multiple predicates

2010-07-23 Thread Peter Schuller
Is there a more terse way to express the same thing?  I suspect there is a mechanism similar to (or perhaps a generalization of) composition for that, but I couldn't find it in the API docs. http://stackoverflow.com/questions/2822140/function-composition-clojure -- / Peter Schuller -- You

Re: filtering with multiple predicates

2010-07-23 Thread ataggart
Not that preserves the short-circuiting behavior of 'and. This works though: (defmacro andf [ fns] (let [x# (gensym)] `(fn [~x#] (and ~@(map #(list % x#) fns) user= (filter (andf integer? odd?) [1 2 3.1]) (1) On Jul 23, 2:27 pm, .Bill Smith william.m.sm...@gmail.com wrote: I want

Re: filtering with multiple predicates

2010-07-23 Thread ataggart
The problem is that 'comp passes the result of one function as the arg of the next, which isn't likely to be applicable for predicate functions, nor will it compose with the 'and macro. On Jul 23, 3:28 pm, Peter Schuller peter.schul...@infidyne.com wrote: Is there a more terse way to express

Re: filtering with multiple predicates

2010-07-23 Thread .Bill Smith
For that matter, I could do this: (defmacro andp ([] true) ([x p] `(~p ~x)) ([x p next] `(let [and# (~p ~x)] (if and# (andp ~x ~...@next) and# On Jul 23, 5:33 pm, ataggart alex.tagg...@gmail.com wrote: Not that preserves the short-circuiting behavior of 'and.  This

Re: filtering with multiple predicates

2010-07-23 Thread ataggart
Quite right! Being a variation on the actual implementation of the 'and macro, it's probably easier to understand than my cobbled together version (needing a gensym should have been a giveaway). On Jul 23, 4:07 pm, .Bill Smith william.m.sm...@gmail.com wrote: For that matter, I could do this:

Re: filtering with multiple predicates

2010-07-23 Thread David Cabana
Here's an approach that doesn't use macros. I'm not sure I'd actually do this, but here it is just for grins. (defn bind [pred] (fn [[x bool]] [x (and (pred x) bool)])) (defn comp# [ preds ] (let [ phi (reduce comp (map bind preds))] (fn [x] (second (phi [x true]) user (filter