This file contains 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
# Define | |
def singledispatch(func): | |
through_map = {} | |
def register(through): | |
def _on(what): | |
through_map[through] = what | |
return what | |
return _on | |
def dispatch(what): |
This file contains 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
(defn fib [] | |
(setf a 0) | |
(setf b 1) | |
(while true (yield a) (setf (, a b) (, b (+ a b))))) | |
(setf it (fib)) | |
(for [x (range 10)] | |
(print (next it))) |