Demo entry 6694581

a

   

Submitted by anonymous on Jan 22, 2018 at 20:41
Language: Python. Code size: 171 Bytes.

def memoise(fn):
    cache = {}
    def wrap(x):
        if x in cache:
            return cache[x]
        cache[x] = fn(x)
        return cache[x]
    return wrap

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).