-
-
Save wecing/6095990 to your computer and use it in GitHub Desktop.
That's why I dislike Haskell sometimes...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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