Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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