From 395aad915a98aaeea721fcf8d24baec989a13154 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 21 Mar 2016 02:34:10 -0400 Subject: fix formatting on a couple of pages --- public/make-memoize.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'public/make-memoize.html') diff --git a/public/make-memoize.html b/public/make-memoize.html index f67c5c5..6dcc7fc 100644 --- a/public/make-memoize.html +++ b/public/make-memoize.html @@ -22,13 +22,13 @@ rest = $(wordlist 2,$(words $1),$1) # How to use: Define 2 variables (the type you would pass to $(call): -# `_<var>NAME</var>_main` and `_<var>NAME</var>_hash`. Now, `_<var>NAME</var>_main` is the function getting -# memoized, and _<var>NAME</var>_hash is a function that hashes the function arguments +# `_NAME_main` and `_NAME_hash`. Now, `_NAME_main` is the function getting +# memoized, and _NAME_hash is a function that hashes the function arguments # into a string suitable for a variable name. # # Then, define the final function like: # -# <var>NAME</var> = $(foreach func,<var>NAME</var>,$(memoized)) +# NAME = $(foreach func,NAME,$(memoized)) _main = $(_$(func)_main) _hash = __memoized_$(_$(func)_hash) @@ -40,16 +40,17 @@ rest = $(wordlist 2,$(words $1),$1) # How to use: # -# _<var>NAME</var>_main = <var>your main function to be memoized</var> -# _<var>NAME</var>_hash = <var>your hash function for parameters</var> -# <var>NAME</var> = $(memoized) +# _NAME_main = your main function to be memoized +# _NAME_hash = your hash function for parameters +# NAME = $(memoized) # # The output of your hash function should be a string following # the same rules that variable names follow. _main = $(_$0_main) _hash = __memoized_$(_$0_hash) -memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(call rest,$($(_hash))) +memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(call rest,$($(_hash))) +

Now, I'm pretty sure that should work, but I have only actually tested the first version.

TL;DR

Avoid doing things in Make that would make you lean on complex solutions like an external memoize function.

-- cgit v1.2.3-2-g168b