Jump to content

Catalan numbers/Pascal's triangle: Difference between revisions

Line 1,563:
derived from Pascal's triangle.'''
 
# diff :: [Int] -> Int
def diff(xs):
'''Difference between the first two items in the list,
if its length is more than one.
Otherwise, the first (only) item in the list.'''
return (
xs[0] - (xs[1] if 1 < len(xs) else 0)
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.