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 +++++------ public/make-memoize.md | 61 +++++++++++++++++++++++---------------------- public/purdue-cs-login.html | 24 +++++------------- public/purdue-cs-login.md | 12 ++++----- 4 files changed, 51 insertions(+), 61 deletions(-) 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.

diff --git a/public/make-memoize.md b/public/make-memoize.md index 03bb2dc..64f4f5f 100644 --- a/public/make-memoize.md +++ b/public/make-memoize.md @@ -3,6 +3,7 @@ A memoization routine for GNU Make functions --- date: "2014-11-20" license: WTFPL-2 +markdown_options: "-markdown_in_html_blocks" --- I'm a big fan of [GNU Make][make]. I'm pretty knowledgeable about it, @@ -29,21 +30,21 @@ unsuitable for my needs. So, I implemented my own, more flexible memoization routine for Make. - # This definition of `rest` is equivalent to that in GMSL - rest = $(wordlist 2,$(words $1),$1) - - # How to use: Define 2 variables (the type you would pass to $(call): - # `_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: - # - # NAME = $(foreach func,NAME,$(memoized)) - - _main = $(_$(func)_main) - _hash = __memoized_$(_$(func)_hash) - memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(call rest,$($(_hash))) +
# This definition of `rest` is equivalent to that in GMSL
+rest = $(wordlist 2,$(words $1),$1)
+
+# How to use: Define 2 variables (the type you would pass to $(call):
+# `_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:
+#
+#     NAME = $(foreach func,NAME,$(memoized))
+
+_main = $(_$(func)_main)
+_hash = __memoized_$(_$(func)_hash)
+memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(call rest,$($(_hash)))
However, I later removed it from the Makefile, as I [re-implemented][reimplement] the bits that it memoized in a more efficient way, such that memoization @@ -53,21 +54,21 @@ Later, I realized that my memoized routine could have been improved by replacing `func` with `$0`, which would simplify how the final function is declared: - # This definition of `rest` is equivalent to that in GMSL - rest = $(wordlist 2,$(words $1),$1) - - # How to use: - # - # _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))) +
# This definition of `rest` is equivalent to that in GMSL
+rest = $(wordlist 2,$(words $1),$1)
+
+# How to use:
+#
+#     _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)))
Now, I'm pretty sure that should work, but I have only actually tested the first version. diff --git a/public/purdue-cs-login.html b/public/purdue-cs-login.html index d047d29..b756096 100644 --- a/public/purdue-cs-login.html +++ b/public/purdue-cs-login.html @@ -33,24 +33,12 @@ SessionDesktopDir=/usr/local/share/xsessions/

If you look at the GDM login screen, it has a "Sessions" button that opens a prompt where you can select any of several sessions:

diff --git a/public/purdue-cs-login.md b/public/purdue-cs-login.md index 81111ca..43bcd68 100644 --- a/public/purdue-cs-login.md +++ b/public/purdue-cs-login.md @@ -46,12 +46,12 @@ If you look at the GDM login screen, it has a "Sessions" button that opens a prompt where you can select any of several sessions: - Last session - - 1. MATE (`mate.desktop`; `Exec=mate-session`) - - 2. CS Default Session (`default.desktop`; `Exec=default`) - - 3. Custom Session (`custom.desktop`; `Exec=custom`) - - 4. FVWM2 (`fvwm2.desktop`; `Exec=fvwm2`) - - 5. gnome.desktop (`gnome.desktop`; `Exec=gnome-session`) - - 6. KDE (`kde.desktop`, `Exec=startkde`) + - 1\. MATE (`mate.desktop`; `Exec=mate-session`) + - 2\. CS Default Session (`default.desktop`; `Exec=default`) + - 3\. Custom Session (`custom.desktop`; `Exec=custom`) + - 4\. FVWM2 (`fvwm2.desktop`; `Exec=fvwm2`) + - 5\. gnome.desktop (`gnome.desktop`; `Exec=gnome-session`) + - 6\. KDE (`kde.desktop`, `Exec=startkde`) - Failsafe MATE (`ShowGnomeFailsafeSession=true`) - Failsafe Terminal (`ShowXtermFailsafeSession=true`) -- cgit v1.2.3