Skip to content

Instantly share code, notes, and snippets.

@truthadjustr
Created December 14, 2018 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save truthadjustr/f9aed479b689f36fe5c83099a03894ca to your computer and use it in GitHub Desktop.
Save truthadjustr/f9aed479b689f36fe5c83099a03894ca to your computer and use it in GitHub Desktop.
fpython: sums list of numbers
# sums a list of numbers
def f (p):
if not isinstance (p,list):
raise ValueError ("type error")
x, *xs = p
return x if xs == [] else x + f (xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment