Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Steve Purcell
On 11 Jun 2010, at 20:35, Russell Christopher wrote: didn't need the assoc in my previous try (defn of [n] (letfn [(f [res k] (if (= 0 (rem (:n res) k)) {:n (/ (:n res) k) :fs (conj (:fs res) k)} res))] (:fs (reduce f {:n n :fs []}

Re: ICFP 2009 / ICFP 2010

2010-06-12 Thread Craig Andera
There's one question that came up when I implemented this. Is there a way to get the name of a clojure function, when all I have is the function object? Is it stored alongside the function? I didn't see any metadata or anything. Would I really have to reverse lookup the name in some namespace

Re: ICFP 2009 / ICFP 2010

2010-06-12 Thread Michał Marczyk
On 12 June 2010 04:51, Eugen Dück eu...@dueck.org wrote: I put the first part of my implementation online: http://read-eval-puke.blogspot.com/2010/06/icfp-2009-orbit-binary-file-reader.html so anyone who's interested do have a look. Interesting, thanks! There's one question that came up when

Re: Reduce a function over more than one sequence (like map)

2010-06-12 Thread Jürgen Hötzel
2010/6/11 Nathan Sorenson n...@sfu.ca: Is there a way to fold over multiple sequences, in the same way that 'map' can apply a multi-parameter function over several seqs? In other words, is there a function like this: There is no need for a special purpose reduce* function. Using destructing

Re: Interface to integrate transactions with Clojure transactions

2010-06-12 Thread Daniel Werner
On Jun 11, 11:41 pm, Chris Kent cjk...@gmail.com wrote: Is this what you're thinking of? http://groups.google.com/group/clojure/browse_thread/thread/aa22a7095... I'm not sure what happened, it sounded promising but I've not seen it mentioned again since this thread went quiet. This is

Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-12 Thread Thomas Kjeldahl Nilsson
What are the major differences in the different distributions, particularly for Clojure development? I've got everything (Slime, Paredit, Clojure-mode etc) set up in Carbon emacs and it works great, just curious if there are any substantials gains to be had in Aquamacs or other alternative

Re: ANN: Robert Hooke

2010-06-12 Thread Phil Hagelberg
On Fri, Jun 11, 2010 at 10:29 AM, Tom Faulhaber tomfaulha...@gmail.com wrote: Nice! I think this kind of functionality should end up getting promoted. I have also written this a couple of times and thought about generalizing it. I'm glad you did. Cool. I'm not sure how broadly-applicable it

Re: Protocol type hints - Java interface

2010-06-12 Thread David Nolen
On Sat, Jun 12, 2010 at 11:21 AM, David McNeil mcneil.da...@gmail.comwrote: As near as I can tell the protocol type hints are not used in the resulting Java interface. For example: (ns demo.impl.boat) (defprotocol Boat (go [boat ^int distance])) You can't put type hints on protocol

Re: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-12 Thread David Nolen
Carbon Emacs is great, I used it for years. However it will no longer be supported. I've since switched over to the Cocoa 23 port. It's lacking in some niceties but it's totally usable. On Sat, Jun 12, 2010 at 8:25 AM, Thomas Kjeldahl Nilsson tho...@kjeldahlnilsson.net wrote: What are the

Re: Protocol type hints - Java interface

2010-06-12 Thread David McNeil
David - Thanks for the tips on definterface and the new statics feature. I will need to look into these because I am not familiar with either. What is the difference between gen-interface and definterface? Thanks. -David McNeil -- You received this message because you are subscribed to the

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Steve Purcell
On 12 Jun 2010, at 16:18, Russell Christopher wrote: You're right. Hope I haven't offended with the fail, I thought I had tested it - by iterating over a range and comparing it to Uncle Bob's but obviously I didn't do that right and then realized that factorization is likely not O(n)

Re: Protocol type hints - Java interface

2010-06-12 Thread Meikel Brandmeyer
Hi, Am 12.06.2010 um 18:09 schrieb David McNeil: What is the difference between gen-interface and definterface? definterface is a convenience function which just calls gen-interface and imports the resulting interface. Sincerely Meikel -- You received this message because you are

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Russell Christopher
I focused more on idiom than correctness (obviously). Took a risk with not much effort except to see if I could do any better with a toy problem. The answer was no, Uncle Bob's is idiomatic modulo some minor things. On Sat, Jun 12, 2010 at 12:59 PM, Steve Purcell st...@sanityinc.com wrote: On

Re: Protocol type hints - Java interface

2010-06-12 Thread David Nolen
Here is a gist of what statics look like: http://gist.github.com/432465 David On Sat, Jun 12, 2010 at 12:09 PM, David McNeil mcneil.da...@gmail.comwrote: David - Thanks for the tips on definterface and the new statics feature. I will need to look into these because I am not familiar with

Using PRXML lib

2010-06-12 Thread Emeka
Hello All, Could someone direct me on how to write the output of prxml form to a file? Regards, Emeka -- 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

Re: Reduce a function over more than one sequence (like map)

2010-06-12 Thread Nathan Sorenson
Thanks for the replies. Indeed, I have been approaching the issue with destructuring, as suggested. It still seems to me that reduce* is consistent with the behaviour of map, in that it is polyvariadic and doesn't require packing arguments into and out of a single sequence. However, its good to

Re: Using PRXML lib

2010-06-12 Thread Moritz Ulrich
You can use (with-out-str body) to capture the output or prxml to a string and write that string to a file. On Sat, Jun 12, 2010 at 8:53 PM, Emeka emekami...@gmail.com wrote: Could someone direct me on how to write the output of prxml form to a file? -- Moritz Ulrich Programmer, Student,

Re: Using PRXML lib

2010-06-12 Thread Emeka
Hello Moritz, prxml form prints on the console, my aim is to redirect it to print to a file. I have not been able to achieve this. I have looked at the prxml lib code, it prints to *out*, it returns nil. My interest is on capturing the output of prxml and writing it to a file. Regards, Emeka On

agents sending-off to other agents blocks?

2010-06-12 Thread Dan Larkin
Hey all, I've cooked up this example code to demonstrate a point: (send-off (agent nil) (fn [_] (send-off (agent nil) (fn [_] (println Hey!))) (Thread/sleep 4000))) ; Hey! isn't printed for 4 seconds (when the outer agent finishes). Which is that actions sent to an agent

Re: Using PRXML lib

2010-06-12 Thread Emeka
Thanks, it worked :( On Sat, Jun 12, 2010 at 8:23 PM, Moritz Ulrich ulrich.mor...@googlemail.com wrote: You can use (with-out-str body) to capture the output or prxml to a string and write that string to a file. On Sat, Jun 12, 2010 at 8:53 PM, Emeka emekami...@gmail.com wrote: Could

Re: agents sending-off to other agents blocks?

2010-06-12 Thread Moritz Ulrich
I'm not sure why it's doing this, but I read about this in the api documentation - It's intended On Sat, Jun 12, 2010 at 9:41 PM, Dan Larkin d...@danlarkin.org wrote: Hey all, I've cooked up this example code to demonstrate a point: (send-off  (agent nil)  (fn [_]   (send-off    (agent

Re: agents sending-off to other agents blocks?

2010-06-12 Thread Moritz Ulrich
Sorry for the second mail, but here is the passage from clojure.org which mentions the behavior you've seen: 5. If during the function execution any other dispatches are made (directly or indirectly), they will be held until after the state of the Agent has been changed. Maybe it's done to

Re: agents sending-off to other agents blocks?

2010-06-12 Thread Dan Larkin
Thanks for finding that Moritz :) I am not using the value from the current agent in the new agent though, so this dispatch delay is a little annoying. I suppose I can use a future instead of an agent, though it doesn't have all the nice properties that agents do (once action a time). Maybe

Re: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-12 Thread Phil Hagelberg
On Sat, Jun 12, 2010 at 5:25 AM, Thomas Kjeldahl Nilsson tho...@kjeldahlnilsson.net wrote: What are the major differences in the different distributions, particularly for Clojure development? I've got everything (Slime, Paredit, Clojure-mode etc) set up in Carbon emacs and it works great,

Re: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-12 Thread Steven E. Harris
Moritz Ulrich ulrich.mor...@googlemail.com writes: Aquamacs integrates nice, but it changes many emacs keybinding per-default and makes it hard to change them, which is a no-go for me. Here's what I use (so far) to beat it back into shape: (cua-mode 0) (transient-mark-mode 1)

Re: Using PRXML lib

2010-06-12 Thread James Reeves
You can also change the binding of *out* to point directly to your file writer. - James On 12 June 2010 20:43, Emeka emekami...@gmail.com wrote: Thanks, it worked :( On Sat, Jun 12, 2010 at 8:23 PM, Moritz Ulrich ulrich.mor...@googlemail.com wrote: You can use (with-out-str body) to

Re: Mac Emacs users: which version do you prefer (Aquamacs, Carbon Emacs, other?)

2010-06-12 Thread Rob Lachlan
I agree that the cocoa builds are the nicest. But there is one problem that I've had with them: I wasn't able to successfully install swank-clojure through elpa from within that emacs. Curiously, I was able to install it through elpa in aquamacs, and then I had no problem using swank-clojure