4 ms·
Just a small note. In the definition of the Cons class, the iterate method is calling each time to len before proceeding, and that is terribly inefficient. d
by jhtom 13y ago
Just a small note. In the definition of the Cons class, the iterate method is calling each time to len before proceeding, and that is terribly inefficient.
def __iter__(self):
current = self
while len(current) > 0:
yield current.head
current = current.tail
- lihaoyi 13y agoYeah, we haven't looked at performance at all. "The Wonderful Thing About A Dancing Bear Is Not How Well He Dances, But That He Dances At All" We'll get to teaching him to dance well later!
- jhtom 13y agoSpeaking about concepts perhaps Norvig post "(How to Write a (Lisp) Interpreter (in Python))" http://norvig.com/lispy.html http://norvig.com/lispy.html can be useful. The concept of a dotted pair (the car and the cdr are interesting historical facts. I wish you the best for your presentation for the Mit class, it seems interesting but perhaps it should have a link to some standard techniques like machine learning. I am curious about the small projects, will they be available in the page of the course?
- lihaoyi 13y agoThe homework assignments are all online; One of the project requirements is that the code be hosted somewhere public where people can go and see it, so it'd probably be pretty easy to get a list from the prof