Skip to content

Instantly share code, notes, and snippets.

Created October 31, 2016 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d24748d5b6de88b31f18965932744211 to your computer and use it in GitHub Desktop.
Save anonymous/d24748d5b6de88b31f18965932744211 to your computer and use it in GitHub Desktop.
import llist
import scipy.stats
look = {}
cache = llist.dllist()
while(True):
val = scipy.stats.zipf.rvs(1.01)
if val in look:
cache.remove(look.pop(val))
elif len(cache) > 0:
cache.popright()
look[val] = cache.appendleft(val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment