about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2022-12-16 12:24:23 -0500
committerelioat <elioat@tilde.institute>2022-12-16 12:24:23 -0500
commitd5c10bcdb5681ab1fc23998439a0c44b6955f673 (patch)
treee35d9778b3544397e4cab67fff671400606ed35d
parenteaf9cbdb1d18e6fcd78c7673d4947fb96f409839 (diff)
downloaddecember-2022-d5c10bcdb5681ab1fc23998439a0c44b6955f673.tar.gz
...
-rw-r--r--log.txt5
-rw-r--r--rnd/js/memoize.js9
2 files changed, 13 insertions, 1 deletions
diff --git a/log.txt b/log.txt
index 0c33f52..7fbcd7b 100644
--- a/log.txt
+++ b/log.txt
@@ -11,4 +11,7 @@
 10 DEC: Refactored and refocused on my lil cataloguing utility. Now it is just used to save links. The core functionality is complete! Next will add some user interface
 11 DEC: Wrapped the lil cataloguing utility in a very minimal cli interface. Could take it farther, but going to call it done for the time being!
 12 DEC: No code today, but sketched an app that I've long dreamed of in wireframes. Shared those with a friend and talked through the feasibility of the idea.
-13 DEC: Last night I wrote up some thoughts on the forever computer/permacomputing, etc. I'm hoping to hone what I wrote into something a bit more cogent. Had some interesting conversations about it all online. Played with combinatorial logic a lil' bit
\ No newline at end of file
+13 DEC: Last night I wrote up some thoughts on the forever computer/permacomputing, etc. I'm hoping to hone what I wrote into something a bit more cogent. Had some interesting conversations about it all online. Played with combinatorial logic a lil' bit
+14 DEC: Work ate me. Lots of data analysis. Was fun, but cooked my brain. Didn't do much hobby programming.
+15 DEC: <<see 14 DEC>>
+16 DEC: 
\ No newline at end of file
diff --git a/rnd/js/memoize.js b/rnd/js/memoize.js
new file mode 100644
index 0000000..b70d95f
--- /dev/null
+++ b/rnd/js/memoize.js
@@ -0,0 +1,9 @@
+const memoize = (f) => {
+  const cache = {};
+
+  return (...args) => {
+    const argStr = JSON.stringify(args);
+    cache[argStr] = cache[argStr] || f(...args);
+    return cache[argStr];
+  };
+};
\ No newline at end of file