From 6ea56ebf7e2ee9fc06423ae36ed3b852e7e80948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 13 Jul 2020 15:35:52 +0200 Subject: lol gensym. --- static/script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 58642b09..27831f35 100644 --- a/static/script.js +++ b/static/script.js @@ -33,11 +33,12 @@ function decimal_time_to_date (time, date) { } } -let gensym_counter = 0; -function gensym (prefix) { - gensym_counter++; - return prefix + gensym_counter; -} +/* if only there was such a thing as a let to wrap around my lambda... */ +let gensym = (function(counter) { + return function gensym (prefix="gensym") { + return prefix + ++counter; + } +})(0); /* start and end time for calendar page */ let start_time = new Date(); -- cgit v1.2.3