Week 20140406

Dan Grossman

  • functions over lists are usually recursive: empty list; non-empty list (hd, tl)
  • let expression: let...in...end
  • Do a recursive computation, store in (local binding)
  • Option: isSome, valOf
  • Bool comparisons: andalso, orelse, not
  • real is not an equality type (subject to round errors)
  • no mutation --> no need to worry about alias or copies --> implementation more efficient & better security
  • Done HW1

Brandon Rhodes Pycon talk

  • Gustavo Duarte -- what your computer does while you wait
  • Dan Luu -- how misaligning data can increase performance 12x
  • Python store general purpose data structures (eg. tuple) as array of addresses
  • append on a list adds extra spaces -- amortization
  • list is fast for tail operations: append, pop. Not pop(0), insert(0)
  • dict is an array with keys stored at integer indexes according to hash value:
    • hash -- key address -- value address
    • PyCon 2010 "The mighty dictionary"
    • can build compound keys with tuple
  • set: dictionary with no keys
  • deque, heapq
  • 2013 PyCon, the clean architecture in Python

Miscellaneous

Comments

Comments powered by Disqus