This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''' | |
| From http://code.activestate.com/recipes/363602-lazy-property-evaluation/ | |
| Usage: | |
| class MyClass(): | |
| @lazyloaded | |
| def config(self): | |
| return {'yay': 'nay'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sqrt | |
| from itertools import islice, chain | |
| def subtract_coords(a, b): | |
| '''Returns a - b''' | |
| return (a[0] - b[0], a[1] - b[1]) | |
| def dot_product(a, b): | |
| return a[0] * b[0] + a[1] * b[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "errors" | |
| ) | |
| type Maybe interface { | |
| Return(value interface{}) Maybe | |
| Bind(func(interface{}) Maybe) Maybe |