Skip to content

Instantly share code, notes, and snippets.

@wecing
Created July 27, 2013 19:29
Show Gist options
  • Save wecing/6095990 to your computer and use it in GitHub Desktop.
Save wecing/6095990 to your computer and use it in GitHub Desktop.
That's why I dislike Haskell sometimes...
# this won't work because python's lambda doesn't have real pattern matching
return reduce(lambda ((acc, prev_nl), (line_idx, (x, nl))): (acc + [([x], line_idx+1)] if prev_nl else acc[:-1]+[(acc[-1][0]+[x], acc[-1][1])], nl), enumerate(lines_nl), ([], True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment