[hack] Add a naive memoizer
[hack] Add a naive memoizer

Summary:
This diff adds a nice little helper to memoize member functions.

This will be used by the Flow infra to memoize the list of children of an AST node.

Reviewed By: mroch

Differential Revision: D8932182

fbshipit-source-id: ca0c724f07e5db80cf84ff2895ac3f7eec3fa697

samwgoldman/flow,mroch/flow,jamesgpearce/flow,JonathanUsername/flow,samwgoldman/flow,nmote/flow,popham/flow,JonathanUsername/flow,samwgoldman/flow,facebook/flow,facebook/flow,AgentME/flow,AgentME/flow,AgentME/flow,jamesgpearce/flow,samwgoldman/flow,samwgoldman/flow,popham/flow,mroch/flow,facebook/flow,popham/flow,gabelevi/flow,JonathanUsername/flow,gabelevi/flow,gabelevi/flow,nmote/flow,mroch/flow,popham/flow,facebook/flow,jamesgpearce/flow,facebook/flow,mroch/flow,jamesgpearce/flow,jamesgpearce/flow,gabelevi/flow,popham/flow,gabelevi/flow,gabelevi/flow,JonathanUsername/flow,AgentME/flow,nmote/flow,popham/flow,nmote/flow,JonathanUsername/flow,facebook/flow,gabelevi/flow,samwgoldman/flow,mroch/flow,AgentME/flow,jamesgpearce/flow,JonathanUsername/flow,jamesgpearce/flow,nmote/flow,facebook/flow,mroch/flow,popham/flow,JonathanUsername/flow,samwgoldman/flow,mroch/flow,nmote/flow,nmote/flow