7 people like it.
Like the snippet!
Sometimes you might wish to memoize a function whose input doesn't have the equality and comparison constraints, or maybe the comparison of your given type is just too slow for what you need. To fix this, you simply provide a function which converts the input into something more fitting as an extra parameter.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: |
|
Link: | http://fssnip.net/63 |
Posted: | 13 years ago |
Author: | Rick Minerich |
Tags: | memoize , memoization , functions , utility |