diff options
author | Todd M. Guerra <toddguerra@gmail.com> | 2015-10-09 11:14:29 -0400 |
---|---|---|
committer | Todd M. Guerra <toddguerra@gmail.com> | 2015-10-09 11:14:29 -0400 |
commit | fc3c56ee938dbb7231127465b0e9ab5fa7f2da40 (patch) | |
tree | 444181fbb299567b566a038ab4241e31ca519a97 /python3.html.markdown | |
parent | 6d3f52b7f01409818853de6148abf1d8fe57fab0 (diff) | |
parent | dcd9093d6467166a2946008c55f5e0582a15e20c (diff) |
Merge remote-tracking branch 'adambard/master'
Conflicts:
java.html.markdown
Diffstat (limited to 'python3.html.markdown')
-rw-r--r-- | python3.html.markdown | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index acd6187c..cd1a83cc 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -550,10 +550,13 @@ add_10(3) # => 13 # There are also anonymous functions (lambda x: x > 2)(3) # => True +(lambda x, y: x ** 2 + y ** 2)(2, 1) # => 5 # TODO - Fix for iterables # There are built-in higher order functions map(add_10, [1, 2, 3]) # => [11, 12, 13] +map(max, [1, 2, 3], [4, 2, 1]) # => [4, 2, 3] + filter(lambda x: x > 5, [3, 4, 5, 6, 7]) # => [6, 7] # We can use list comprehensions for nice maps and filters |