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 names

Re: ICFP 2009 / ICFP 2010

2010-06-12 Thread Michał Marczyk
On 12 June 2010 04:51, Eugen Dück 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 I implement

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

2010-06-12 Thread Jürgen Hötzel
2010/6/11 Nathan Sorenson : > 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 binding as

Re: Interface to integrate transactions with Clojure transactions

2010-06-12 Thread Daniel Werner
On Jun 11, 11:41 pm, Chris Kent 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 exactly what I w

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 distrib

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

2010-06-12 Thread Moritz Ulrich
I prefer the native Emacs.app compiled from source. 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. Also, if you have a nicely-configurated Emacs.app instance running, you can switch easily to other "standard" em

Re: ANN: Conjure 0.6 Released

2010-06-12 Thread James Reeves
On 11 June 2010 22:52, Matt wrote: > I have thought about much of what you posted. My replies are below. > > 1. I have looked at stronger integration of ring and Conjure, but the > latest version of Ring was a big change from the previous version and > I wanted to get a new version of Conjure out.

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

2010-06-12 Thread Russell Christopher
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) anyway. I'll probably take more time next time. Regards, Russell

Protocol type hints - Java interface

2010-06-12 Thread David McNeil
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])) Leads to: javap -classpath target/classes demo.impl.boat.Boat public interface demo.impl.boat.Boat{ public abstract jav

Re: ANN: Robert Hooke

2010-06-12 Thread Phil Hagelberg
On Fri, Jun 11, 2010 at 10:29 AM, Tom Faulhaber 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 is--you want it when

Re: Protocol type hints - Java interface

2010-06-12 Thread David Nolen
On Sat, Jun 12, 2010 at 11:21 AM, David McNeil wrote: > 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 methods, at least as

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 ma

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 Googl

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) an

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 subscrib

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 wrote: > On 12 Jun 2010, at 16

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 wrote: > 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 dif

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 kno

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 wrote: > Could someone direct me on how to write the output of prxml form to a file? -- Moritz Ulrich Programmer, Student, Almost normal Guy htt

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 age

Re: Using PRXML lib

2010-06-12 Thread Emeka
Thanks, it worked :( On Sat, Jun 12, 2010 at 8:23 PM, Moritz Ulrich 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 wrote: > > Could someone direct me on how to write the output of

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 wrote: > Hey all, > > I've cooked up this example code to demonstrate a point: > > (send-off >  (agent nil) >  (fn [_] >   (send-off >    (agent nil) >    (

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 pre

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 I'

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 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, just curious if there are

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

2010-06-12 Thread Steven E. Harris
Moritz Ulrich 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) (pending-delete-mode 1) ;; I'm not ready t

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 wrote: > Thanks, it worked :( > > On Sat, Jun 12, 2010 at 8:23 PM, Moritz Ulrich > wrote: >> >> You can use (with-out-str &body) to capture the output or prxml to a >> string and

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 from