Re: Transforming map entries

2011-02-23 Thread Chris Maier
) > > user=> (walk my-fn identity my-map) > {:first "JOHN", :last "SMITH", :age 25} That looks pretty nice. I'll give that a shot, thanks. > > On Feb 23, 6:27 am, Chris Maier wrote: >> Can anybody explain why fmap, when operating on an IPersistentM

Re: Transforming map entries

2011-02-23 Thread Chris Maier
Can anybody explain why fmap, when operating on an IPersistentMap, only passes the function the value of the map entry, instead of the entire map entry (i.e., the key and value pair)? It seems a bit odd in that all the other implementations of fmap operate on the entire item in the sequence. Also

Re: Moderately off-topic: installing emacs on OSX

2010-12-12 Thread Chris Maier
On Fri, Dec 10, 2010 at 6:24 AM, Steve Purcell wrote: >> If you have issues with emacs failing to pick up the right executables, > you can use the following nifty trick to ensure Emacs' $PATH matches the > one you've configured for Bash in Terminal: > > (defun set-exec-path-from-shell-PATH () >  (

Re: Haskell's scanl

2010-12-01 Thread Chris Maier
That sounds like 'reductions': (reductions + [1 2 4 8]) ==> (1 3 7 15) Chris On Wed, Dec 1, 2010 at 10:20 PM, Alex Baranosky wrote: > My friend's playing with Haskell, and asked me how I'd write a function to > take a list and return a list of the sums like so: > (f [1 2  4 8]) > => [1 3 7 15]

Re: Function Design: sequence or "&" argument?

2010-11-16 Thread Chris Maier
Ah, laziness... thanks Christophe. For my particular application laziness doesn't matter (so that hadn't occurred to me) but that's a good general principle to keep in mind. Thanks, Chris On Tue, Nov 16, 2010 at 11:31 AM, Christophe Grand wrote: > Hi, > > On Tue, Nov 16

Re: Function Design: sequence or "&" argument?

2010-11-16 Thread Chris Maier
That makes sense... thanks, Meikel. Maybe my example of + wasn't the best, given its mathematical nature. Here's my situation: I'm writing some software to analyze some protein datasets, part of which entails generating a Venn diagram of their intersections. Each dataset has a unique name, and m

Re: Newbie question on defstructs

2010-11-13 Thread Chris Maier
Another approach would be to use records and protocols: (defprotocol HasCees (c [this] "Returns a 'c'")) (defrecord Foo [a b] HasCees (c [this] (+ (:a this) (:b this Now, to use it: user> (def my-foo (Foo. 1 2) #'user/my-foo user> (c my-foo) 3 This is practically a drop-in replac

Re: Images in autodoc?

2010-10-28 Thread Chris Maier
My interest is general improvement of Clojure documentation. At the conj, I spoke with Zack Kim about helping to improve the state of the documentation. My goal was to contribute additional documentation for vars that are lacking, as well as clarifying some of the more confusing doc strings (actu

Re: Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Chris Maier
Here we go: http://david-mcneil.com/post/1393750407/clojure-conj-day-1-notes Check the notes at the bottom from Rich's talk; it's the part about unified primitives and boxed numbers. Chris On Thu, Oct 28, 2010 at 7:20 AM, Chris Maier wrote: > I don't recall all the reason

Re: Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Chris Maier
I don't recall all the reasons and details from Rich's conj talk, but this is expected behavior now; your numbers are now Longs internally by default. See http://github.com/clojure/clojure/commit/845c63e9317826a5564ef766550562b3fbe68181 Chris On Thu, Oct 28, 2010 at 6:00 AM, Jacek Laskowski wr

Re: how to pass lazy seq to function for processing without keeping the head?

2010-10-27 Thread Chris Maier
On Wed, Oct 27, 2010 at 10:18 AM, rb wrote: > P.s. I still don't understand though why the 'calls' argument to the > store-calls function is not a held reference to the head of the lazy > seq... I think (and someone please correct me if I'm wrong) that the head of 'calls' isn't being retained bec

Re: Images in autodoc?

2010-10-26 Thread Chris Maier
> On Tue, Oct 26, 2010 at 4:44 PM, Timo Mihaljov wrote: >> If you wanted to get real fancy, you could even check if the code >> block is a list, and then resolve each symbol inside the list, so >> that, for example, resolve's docstring would look like this at the >> REPL: >> >> user=> (doc resolve

Re: Images in autodoc?

2010-10-26 Thread Chris Maier
On Tue, Oct 26, 2010 at 1:08 PM, Tom Faulhaber wrote: > The bigger problem is figuring out what to tell folks who type (doc > foo) at the REPL and get a bunch of gobbledegook back. That's the > thing that's been making me look for a better format than markdown. > (Autodoc already does markdown tra