Re: Newbie macro problems

2009-07-08 Thread Jonas Enlund
2. http://gist.github.com/142939 On Wed, Jul 8, 2009 at 7:19 PM, Jonas Enlund wrote: > 1. Ok, I'll consider that. > > 2. Yes, I'll post a link when I have uploaded the code somewhere. > > 3. It has not yet arrived > > 4. No. I have two sources of inspiration. Pattern matching in PLT > Scheme and

Re: Newbie macro problems

2009-07-08 Thread Jonas Enlund
1. Ok, I'll consider that. 2. Yes, I'll post a link when I have uploaded the code somewhere. 3. It has not yet arrived 4. No. I have two sources of inspiration. Pattern matching in PLT Scheme and this link: http://groups.csail.mit.edu/mac/users/gjs/6.945/psets/ps05/ps.txt (which is almost SICP

Re: Newbie macro problems

2009-07-08 Thread Laurent PETIT
2009/7/8 Sean Devlin : > > Laurent, > > I don't quite understand your point.  Could you please explain it a > little more? Oh, I wanted to be quick. I think using the term "array" instead of "vector" (which is the real term used for datastructure created by a [:a :b :c :d] form) may be confusing

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
Good point. I'll be careful to use the term vector in the future, and array for java interop only. On Jul 8, 12:30 pm, Laurent PETIT wrote: > 2009/7/8 Sean Devlin : > > > > > Laurent, > > > I don't quite understand your point.  Could you please explain it a > > little more? > > Oh, I wanted to

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
Laurent, I don't quite understand your point. Could you please explain it a little more? Thanks On Jul 8, 12:16 pm, Laurent PETIT wrote: > 2009/7/8 Sean Devlin : > > > > > This seems like a good use for a macro.  A couple of thoughts: > > > 1.  Use arrays instead of lists > > In clojure, it i

Re: Newbie macro problems

2009-07-08 Thread Laurent PETIT
2009/7/8 Sean Devlin : > > This seems like a good use for a macro.  A couple of thoughts: > > 1.  Use arrays instead of lists > In clojure, it is "best practice" to use arrays for data.  So, your > macro call should look like this. > > (match [1 2 3] >       [1 x]   (+ x x) >       [1 x y] (+ x y)

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
4. Is this example from SICP? On Jul 8, 12:12 pm, Sean Devlin wrote: > This seems like a good use for a macro.  A couple of thoughts: > > 1.  Use arrays instead of lists > In clojure, it is "best practice" to use arrays for data.  So, your > macro call should look like this. > > (match [1 2 3]

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
This seems like a good use for a macro. A couple of thoughts: 1. Use arrays instead of lists In clojure, it is "best practice" to use arrays for data. So, your macro call should look like this. (match [1 2 3] [1 x] (+ x x) [1 x y] (+ x y)) 2. Could you post the source to mat

Newbie macro problems

2009-07-08 Thread Jonas
Hi. I'm developing a simple pattern matching library for clojure but I am having trouble with macros (which I have almost zero experience with). I have a function `make-matcher` (make-matcher ) which returns a function that can pattern match on data and returns a map of bindings (or nil in cas