Skip to content

Instantly share code, notes, and snippets.

@oleg
Created March 3, 2011 07:27
Show Gist options
  • Save oleg/852469 to your computer and use it in GitHub Desktop.
Save oleg/852469 to your computer and use it in GitHub Desktop.
pascal
padStart list = 0 : list
padEnd list = list ++ [0]
next l = zipWith (+) (padEnd l) (padStart l)
pascal d
| d <= 0 = []
| d == 1 = [1]
| d == 2 = [1, 1]
| otherwise = next $ pascal $ d - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment