Re: Help with Math Question

2009-06-04 Thread Michael Wood
On Thu, Jun 4, 2009 at 8:37 AM, Mark Reid wrote: > > Hi, > > Maybe I'm missing something but doesn't + fit the bill (or any > symmetric function)? > > (== (reduce + 3 [1 2 3]) (reduce + 3 [3 2 1])) ;; => true > > In this case f = g = + and a0 = b0 for any choice of a0 and v. I think he can't cho

Re: Help with Math Question

2009-06-04 Thread Daniel Lyons
On Jun 3, 2009, at 11:23 PM, CuppoJava wrote: > > Hey guys, > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > > (reduce f a0 v) = (reduce g b0 (reverse v)) >

Re: Spring and Clojure

2009-06-04 Thread Dmitriy Kopylenko
At this point I have no particular use case. We are solely a Spring shop where we build Spring web apps and we use Groovy beans (using dynamic lang support in Spring) for some stuff like MVC controllers, XML parsing, etc. I thought that it would be interesting to incorporate some Clojure beans for

Re: Help with Math Question

2009-06-04 Thread Mark Reid
Hi again, I misinterpreted the question first time around but here's another attempt. Given f, a0 and v, let b0 = (reduce f a0 v) = f( f( f( f(a0, v[1]), v [2]), ...), v[n]) Now define the function g to ignore its second argument and return its first. That is, g(x, y) = x. Then (reduce g b0 (r

Re: Spring and Clojure

2009-06-04 Thread Stuart Halloway
I think Clojure addresses (at the language level, and better) all the issues that Spring addresses. So in the long run Spring is unnecessary in a Clojure world. But in the short run you have the codebase you have, and the skills that you have. So if it makes sense, do it. Stu > At this po

Re: Help with Math Question

2009-06-04 Thread Konrad Hinsen
On Jun 4, 2009, at 7:23, CuppoJava wrote: > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > > (reduce f a0 v) = (reduce g b0 (reverse v)) If that's for any

Re: Help with Math Question

2009-06-04 Thread philip.hazel...@gmail.com
On Jun 4, 6:23 am, CuppoJava wrote: > Hey guys, > I'm really stuck on this math question, and I'm wondering if you guys > know of any links that may help me. > > Given: f(x,y), a0, a list of numbers v. > Find: g(x,y) and b0 such that: > >  (reduce f a0 v) = (reduce g b0 (reverse v)) > > Thanks fo

Re: Help with Math Question

2009-06-04 Thread Michael Wood
On Thu, Jun 4, 2009 at 12:27 PM, Mark Reid wrote: > > Hi again, > > I misinterpreted the question first time around but here's another > attempt. > > Given f, a0 and v, let b0 = (reduce f a0 v) = f( f( f( f(a0, v[1]), v > [2]), ...), v[n]) > > Now define the function g to ignore its second argume

Re: Where does the language end and the libraries begin?

2009-06-04 Thread Sean Devlin
There was this language wiritten in '58 that can do just that. It's called LISP. Here's Paul Grahams paper on eval: http://lib.store.yahoo.net/lib/paulgraham/jmc.ps Get to the part where he defines eval, and let your brain stay on that for a while. You'll see WHY macros work, and never ever go

Silly question from Programming Clojure

2009-06-04 Thread Andrew Wagner
Hey ya'all! Just got my copy of Programming Clojure last night (great book, kudos Stuart!). I've got a silly question now. There's a comment in the book about one piece of code where it says "the symbol gets associated with a var which gets bound to a value". That sounds strange to my ear. Wouldn't

Re: Where does the language end and the libraries begin?

2009-06-04 Thread Victor Rodriguez
On Thu, Jun 4, 2009 at 8:13 AM, Sean Devlin wrote: > > There was this language wiritten in '58 that can do just that. It's > called LISP. Another good example of a language written in itself is Squeak Smalltalk. Check out the paper "Back to the future: the story of Squeak, a practical Smalltalk

Re: You know you've been writing too much Clojure when...

2009-06-04 Thread BrianS
You see a license plate in front of you DEFN1A3F and you wonder what the function 1A3F would return...happened to me the other day. On May 29, 2:51 pm, Paul Stadig wrote: > You meant to type disclosure, but instead you typed disclojure. > > Paul --~--~-~--~~~---~-

Re: swing-utils: another set of helpers (was: Re: swing-utils: patch - returning the listeners)

2009-06-04 Thread Stephen C. Gilardi
On Jun 3, 2009, at 2:40 AM, Meikel Brandmeyer wrote: Hi Stephen, uh? I didn't notice you put up a swing-utils in contrib. I have a set of little macros + helper, which might also be interesting: I like them! (import 'javax.swing.SwingUtilities) (defn do-swing* "Run the given thunk in the

Re: Silly question from Programming Clojure

2009-06-04 Thread Pierpaolo Bernardi
On Thu, Jun 4, 2009 at 2:28 PM, Andrew Wagner wrote: > Hey ya'all! > Just got my copy of Programming Clojure last night (great book, kudos > Stuart!). I've got a silly question now. There's a comment in the book about > one piece of code where it says "the symbol gets associated with a var which

Re: Where does the language end and the libraries begin?

2009-06-04 Thread Konrad Hinsen
On Jun 4, 2009, at 7:34, CuppoJava wrote: > I've always considered the core part of the language to be the portion > that cannot be written in the language itself. > > I don't think you can write an Clojure if form in Clojure. Why not? You need something outside the language to get any impleme

Re: Help with Math Question

2009-06-04 Thread CuppoJava
Hey guys. Thanks for the help. I have to clarify my question a bit. f(x,y) and a0 are given and do not assume any properties. Find g(x,y) and b0, such that for *any* list of numbers v, (reduce f a0 v) = (reduce g b0 (reverse v)) -- In case it helps at all, my specif

Re: Help with Math Question

2009-06-04 Thread philip.hazel...@gmail.com
On Jun 4, 3:00 pm, CuppoJava wrote: > Hey guys. > Thanks for the help. I have to clarify my question a bit. > > f(x,y) and a0 are given and do not assume any properties. > Find g(x,y) and b0, such that for *any* list of numbers v, > > (reduce f a0 v) = (reduce g b0 (reverse v)) This is not alway

Re: What's the function that checks if an object is "sequence-able"?

2009-06-04 Thread sross
On Jun 3, 8:34 pm, "Stephen C. Gilardi" wrote: > On Jun 3, 2009, at 12:53 PM, CuppoJava wrote: >  From that we could derive isSeqable in Java as > >    static public bool isSeqable(Object coll){ >        return >          (coll instanceof ISeq) || >          (coll instanceof Seqable) || >        

Interest in creating a NYC Clojure user group?

2009-06-04 Thread Eric Thorsen
I went to the Bay Area Clojure group meeting last night which was great. People demoed some very interesting stuff and it was great having face time with more people using Clojure. I wanted to see what kind of interest there might be in creating a Clojure user group in the NY metro area to meet

Re: Interest in creating a NYC Clojure user group?

2009-06-04 Thread Boris Mizhen - 迷阵
I would attend from time to time, but there is lispnyc group http://www.lispnyc.org/home.clp I think it makes more sense to join them - for network effects :) Boris On Thu, Jun 4, 2009 at 12:09 PM, Eric Thorsen wrote: > > I went to the Bay Area Clojure group meeting last night which was > great

Wish: (-> x) should be legal

2009-06-04 Thread Ozzi Lee
While writing a macro, I noticed that (-> x) raises an error. It would be useful for this to be legal, and equivalent to (-> x identity). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Interest in creating a NYC Clojure user group?

2009-06-04 Thread DiGash
I am interested and would attend once a month in the Manhattan. LispNYC has been quiet for a while and they more focus on Common Lisp. On Jun 4, 12:09 pm, Eric Thorsen wrote: > I went to the Bay Area Clojure group meeting last night which was > great.  People demoed some very interesting stuff a

Contributing tests

2009-06-04 Thread Richard Newman
One of the things that occurred to me at last night's Meetup is that there seems to be a sizable group of people who are keen on contributing to Clojure, including basic "drudge" work. It also seems apparent that having a decent test suite is valuable (if only for the sake of appearances and adopt

Re: Interest in creating a NYC Clojure user group?

2009-06-04 Thread ethor...@enclojure.org
Thanks Boris, I have been to the Lisp meeting several times. Learning Lisp changed my life, however... The energy around Clojure at the JavaOne conference is palpable (IMHO). I'm a commercial software developer using Clojure to build commercial software and I really would like the group to be a

Re: Reminder: Bay Area Clojure User Group meeting in SF during JavaOne (6/3) with Rich Hickey

2009-06-04 Thread Paul Mooser
I wanted to say thank you to everyone involved in setting this up - Tom and Amit for organizing, and everyone who presented. It was fun to get a chance to see what other people are doing in clojure, and to get a preview of what Rich has been working on and to hear his thoughts on near-to-mid term

Re: Help with Math Question

2009-06-04 Thread Paul Mooser
For a general non-commutative operation, I'm not sure you can do this without keeping extra state around. You can clearly cheat by accumulating state as you run reduce, and then as the last reduce step perform the actual computation, but that isn't any better than the original problem you're tryin

Re: What's the function that checks if an object is "sequence-able"?

2009-06-04 Thread Stephen C. Gilardi
On Jun 4, 2009, at 10:58 AM, sross wrote: wouldn't it be best to define seqable? in terms of seq ? Your version works and is actually faster than what I posted in most cases. It's also guaranteed always to be in sync with any (current or future) definition of "seq". I didn't do it the wa

Re: Contributing tests

2009-06-04 Thread Aaron Cohen
It's a great idea, and already in progress. ;) http://code.google.com/p/clojure-contrib/source/browse/#svn/trunk/src/clojure/contrib/test_clojure -- Aaron On Thu, Jun 4, 2009 at 12:31 PM, Richard Newman wrote: > > One of the things that occurred to me at last night's Meetup is that > there s

Re: Silly question from Programming Clojure

2009-06-04 Thread Meikel Brandmeyer
Hi, Am 04.06.2009 um 14:28 schrieb Andrew Wagner: Just got my copy of Programming Clojure last night (great book, kudos Stuart!). I've got a silly question now. There's a comment in the book about one piece of code where it says "the symbol gets associated with a var which gets bound to a

Re: Wish: (-> x) should be legal

2009-06-04 Thread Meikel Brandmeyer
Hi, Am 04.06.2009 um 18:26 schrieb Ozzi Lee: While writing a macro, I noticed that (-> x) raises an error. It would be useful for this to be legal, and equivalent to (-> x identity). (-> x) should be rather equivalent to x. That saves another function call. ;) Sincerely Meikel smime.p7s D

Re: swing-utils: another set of helpers

2009-06-04 Thread Meikel Brandmeyer
Hello Stephen, Am 04.06.2009 um 14:50 schrieb Stephen C. Gilardi: I'm concerned about the first clause in the cond. Both invokeLater and invokeAndWait defer execution until all pending AWT Events have been processed. This suggests to me that they are implemented as events that go on the en

Re: Silly question from Programming Clojure

2009-06-04 Thread Luc Prefontaine
Multiple vars can be bound to a single value. A var without a value is qualified as being unbound. The variable is your focus point here, you do not care much about the value itself. Hard to qualify a value as being unbound, it would not be a value anymore So I guess the relationship is drive

Re: Wish: (-> x) should be legal

2009-06-04 Thread Stephen C. Gilardi
On Jun 4, 2009, at 4:30 PM, Meikel Brandmeyer wrote: (-> x) should be rather equivalent to x. That saves another function call. ;) +1 --Steve smime.p7s Description: S/MIME cryptographic signature

Re: Help with Math Question

2009-06-04 Thread Max Suica
I'm not sure how you're compositing your colors, but the function you're using is not associative or commutative (I checked at lunch, mmm), so I don't think you can reverse order. It's: a + b = (b1 + a1 (1 - b2), a2) Your function might need to be something like a + b = (b1*(1 - a2) + a1 (1 -

Re: Feedback on new persistentmatrix datatype

2009-06-04 Thread aperotte
Konrad, Thanks for hashing this through with me. I thought about it for a while and I think you're right. When I start working on this project again, I'm going to implement it so that index order is consistent across all operations. -Adler On May 27, 12:11 pm, Konrad Hinsen wrote: > On May 2

Re: Wish: (-> x) should be legal

2009-06-04 Thread Max Suica
But (-> x identity) => (identity x) => x, so what our friend ozzi suggest sounds pretty on the level. If (identity x) is not equivalent to evaluating x, then, well, that's not the identity function :) --~--~-~--~~~---~--~~ You received this message because you are s

defnk addition to c.c.def

2009-06-04 Thread Meikel Brandmeyer
Hello Stephen, the following is a macro defining a function with keyword arguments. It is called like this: (defnk foo [a b c :x 1 :z 2] (println x z)) a, b and c denote positional arguments, 1 and 2 are default values for x resp. z. This pattern came up several times now, and there were al

Re: defnk addition to c.c.def

2009-06-04 Thread Meikel Brandmeyer
Hi again, Am 05.06.2009 um 00:06 schrieb Meikel Brandmeyer: The docstring is a bit contorted but I'm too sleepy now, to get that right... And of course I'm too sleepy to miss the keyword to symbol conversion (defmacro defnk "Define a function accepting keyword arguments. Symbols up to

Re: Wish: (-> x) should be legal

2009-06-04 Thread Stephen C. Gilardi
On Jun 4, 2009, at 5:56 PM, Max Suica wrote: But (-> x identity) => (identity x) => x, so what our friend ozzi suggest sounds pretty on the level. If (identity x) is not equivalent to evaluating x, then, well, that's not the identity function :) You're correct that the result would be the sa

Re: defnk addition to c.c.def

2009-06-04 Thread Sean Devlin
Gut gemacht! Absolutely amazing Meikel. Now get some well earned sleep. Sean On Jun 4, 6:22 pm, Meikel Brandmeyer wrote: > Hi again, > > Am 05.06.2009 um 00:06 schrieb Meikel Brandmeyer: > > > The docstring is a bit contorted but I'm too sleepy now, > > to get that right... > > And of course

Re: defnk addition to c.c.def

2009-06-04 Thread Stephen C. Gilardi
On Jun 4, 2009, at 6:54 PM, Sean Devlin wrote: Gut gemacht! Absolutely amazing Meikel. Now get some well earned sleep. Sean I agree. It's a really beautiful piece of code, packed full of Clojure goodness. Nicely done! I checked it into clojure.contrib.def: http://code.google.

A few ideas

2009-06-04 Thread Howard Lewis Ship
I was one of the lucky people who got to chat directly with Rich in SF. One idea I bounced off him was that it would be nice to be able to add documentation to struct maps; both docs about the usage of the struct in general, and further doc about each key (especially a hint about what kind of dat

Laziness vs. Program Flow: what can be done?

2009-06-04 Thread Howard Lewis Ship
So the times when I have the most trouble in Clojure is related to laziness. Using a lot of lazy operations (for, map, etc.) can cause some grief. I was refactoring and added a new parameter to a somewhat common function and didn't catch all the invocations. However, my exception turned up in an

Re: Laziness vs. Program Flow: what can be done?

2009-06-04 Thread Raoul Duke
> I'm not sure what can be done about this kind of problem. The laziness > is wonderful until it breaks ... here's an area where Haskell would > have been able to identify the incorrect call via static analysis. i guess that even in Haskell there are issues with laziness, at least in the wider se

Re: A few ideas

2009-06-04 Thread Chouser
On Thu, Jun 4, 2009 at 8:31 PM, Howard Lewis Ship wrote: > > I was one of the lucky people who got to chat directly with Rich in SF. > > One idea I bounced off him was that it would be nice to be able to add > documentation to struct maps; both docs about the usage of the struct > in general, and

Are agents transaction'y in dosync?

2009-06-04 Thread mifrai
This is probably a dumb question answered somewhere else, but I couldn't find it :( I noticed that there's a send-off in the dosync clause of ants.clj Does send-off hold off enqueue'ing the action when a dosync fails/ repeats or do the actions keep getting added? If it doesn't - well, ant's beh

Re: Silly question from Programming Clojure

2009-06-04 Thread Laurent PETIT
I just got my own copy of the CTM book (Concepts, Techniques and Models of computer programming) ( http://www.info.ucl.ac.be/~pvr/book.html ) and from now on I find it very interesting in introducing all these notions (variable, value, binding, etc.) one step after the other, showing how the diffe