-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresources
33 lines (26 loc) · 2.4 KB
/
resources
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
https://docs.python.org/3/howto/functional.html
OK, but advocates for local mutation, and claims functional and OO clash - says that mutation
of state is fundamental to OO. Probably doesn't realise to just make a new one?
Their presentation of advantages are worth drawing on, but not optimal
Is it worth having an example with iterators? Listcomps are more pythonic, and they probably know them.
Goes through iters -> listcomp -> gen -> monadic chains
Maybe draw on their explanation of map and filter?
itertools has the standard functional collection operations
functools - higher order functions
https://www.ibm.com/developerworks/linux/library/l-prog/index.html
Maybe add in 'what are pre reqs for a functional language?' section to explain that python has the things you need?
why no standard TCO: http://neopythonic.blogspot.com.au/2009/04/tail-recursion-elimination.html, http://neopythonic.blogspot.com.au/2009/04/final-words-on-tail-calls.html
implementation of TCO: https://github.com/baruchel/tco, http://baruchel.github.io/python/2015/11/07/explaining-functional-aspects-in-python/
Guido not a fan of FP, didn't mean to be influenced by FP - but users ended up implementing their own
functions on collections that drew from FP.
"In fact, the reduce function was removed from list of builtin functions in Python 3.0. (However, it's not necessary to send in complaints about the removal of lambda, map or filter: they are staying. :-)"
use functools.reduce since they removed it.
Asserts that TCO isn't possible because it's dynamic? Um...ruby? It does swallow stack traces though.
Python not designed for explicitly recursive solutions - use the higher order functions that are internally iterative
trampoline instead of TCO? http://blog.moertel.com/posts/2013-06-12-recursion-to-iteration-4-trampolines.html
http://www.kylem.net/programming/tailcall.html
map, filter and reduce intro: http://www.bogotobogo.com/python/python_fncs_map_filter_reduce.php
dive in to python chapter: http://www.diveintopython.net/functional_programming/index.html
broad introduction, may be useful to draw on: https://codesachin.wordpress.com/2016/04/03/a-practical-introduction-to-functional-programming-for-python-coders/
suggest as exercises: http://anandology.com/python-practice-book/functional-programming.html
Another intro, heavy use of map, reduce, filter in python 2: https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming