[RSS 0.91]
Friday 21 May, 2010
#Zippy Triples with Groovy and Mango

Here's a Groovy version of the Java code below. It's more or less identical to the Python original.

import uk.co.jezuk.mango.Iterators

def prev_this_next(items) {
  chain = Iterators.ChainIterator(null, items, null)
  (prev, current, next) = Iterators.TeeIterator(chain, 3)
  return Iterators.ZipIterator(prev, current, next)

long_weekend = ["Friday", "Saturday", "Sunday", "Monday"]
yesterday_today_tomorrow = prev_this_next(long_weekend)
for(ytt in yesterday_today_tomorrow) 
  println ytt
Zippy, fruity, groovy ... YEAH!

(Nice work, Jez)
Thomas Guest [e] [w], 22nd May 2010

Enter your comment

Name Email
If you have an account, please log in.
No account? Just create one.

Jez Higgins