On Wed, Nov 5, 2008 at 2:00 PM, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > Duh. Thanks, and I will be adding that to the sequences chapter. :-/ > > Stuart
You're welcome -- looking forward to the book! Best, Graham > >> >> On Wed, Nov 5, 2008 at 12:56 PM, Stuart Halloway >> <[EMAIL PROTECTED]> wrote: >>> >>> (1) Is there a simpler way to define pairwise, which takes an >>> existing >>> sequence and then returns its items a pair at a time? >>> >>> (defn pairwise [& seq] >>> (map vector (take-nth 2 seq) (take-nth 2 (rest seq)))) >> >> The built-in (partition) function does this, no? >> >> (partition 2 my-seq) >> >> Best, >> Graham >> >> >>> >>> (2) When writing a function like pairwise, are there any bright-line >>> rules about whether to use variable arity? >>> >>> Cheers, >>> Stuart >>> >>> >>>> >>> >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---