From 24a605577c8e09a75f8f717f9df1bdc6c8dd8ec3 Mon Sep 17 00:00:00 2001 From: Nick Shipp Date: Tue, 14 Feb 2017 08:41:16 -0500 Subject: initial commit --- zsh/Functions/memoize | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 zsh/Functions/memoize (limited to 'zsh/Functions/memoize') diff --git a/zsh/Functions/memoize b/zsh/Functions/memoize new file mode 100644 index 0000000..c58e65d --- /dev/null +++ b/zsh/Functions/memoize @@ -0,0 +1,11 @@ +if ((! $+MEMOIZE)) { + declare -Ag MEMOIZE +} + +if (($+MEMOIZE[$*])) { + printf '%s' "$MEMOIZE[$*]" + return +} + +MEMOIZE[$*]=$(eval $*) +printf '%s' "$MEMOIZE[$*]" -- cgit v1.2.3-70-g09d2