994 Name: Anonymous 2021-01-22 4:25 nextperm=20210122452
🂲 💞 💛 ❣ 💙 die +1m #357 inhour=42 inday=88 prime=2399 💙 ❣ 💛 💞 🂲
gcd = 7 = (-14)*994 + 39*357
Added an extended Euclid processing step
>>107 to compute the gcd and linear combination factors for the post number and "die" post counter, and attach them to the 362
>>8 "die" posts.
https://dis.tinychan.net/read/prog/1582047203 Added shared parsing of the post number button. Modified the "die" post counter processing step
>>77 to make the counter available in the per-element ephemeral state
>>82. [parsetime, buttonnum, rmslinks, timedelta, count, hourdaily, primes, hearts, gcd, nextperm]
posts code in /prog/
(processors => Array.from (document.querySelectorAll ("div.post > div.body")).filter (e => "die" == e.innerText).forEach (e => (elemstate => processors.forEach (p => p (e, elemstate))) ({}))) ([
(e, estate) => (m => { estate['posttime'] = m [0]; estate['day'] = parseInt (m [1], 10); estate['hour'] = parseInt (m [2], 10); estate['min'] = parseInt (m [3], 10); }) (e.parentNode.querySelector ('span.post_time').innerText.match (/^2021-01-(\d+) (\d+):(\d+)$/)),
(e, estate) => (btn => { estate['button'] = btn; estate['buttonnum'] = parseInt (btn.innerText, 10); }) (e.parentNode.querySelector ('button.num')),
(rmsarray => (e, estate) => { e.innerHTML = "<a class='die-link' href='#" + rmsarray [Math.floor (rmsarray.length * Math.random ())].parentNode.getAttribute ("id") + "'>" + e.innerHTML.trim () + "</a>"; }) (Array.from (document.querySelectorAll ("div.post > div.body")).filter (e => /https?:\/\/(www[.])?stallman[.]org\/archives\//.test (e.innerHTML))),
(procstate => (e, estate) => ((t, last) => { if (last >= 0) { ((h, m) => { e.innerHTML += ' +' + (h > 0 ? h + 'h' : '') + m + 'm'; }) ((t - last - (t - last) % 60) / 60, (t - last) % 60); } procstate['last'] = t; }) ((estate['day'] * 24 + estate['hour']) * 60 + estate['min'], procstate['last'])) ({last: -1}),
(procstate => (e, estate) => { e.innerHTML += ' #' + (estate['diecount'] = (++procstate['count'])); }) ({count: 0}),
((procstate, spec) => (e, estate) => { e.innerHTML += spec.map (([label, keyfun]) => (key => (count => { procstate[key] = count + 1; return ' ' + label + '=' + (count + 1); }) (procstate[key] ?? 0)) (keyfun (estate))).join (''); }) ({}, [['inhour', estate => 'd' + estate['day'] + 'h' + estate['hour']], ['inday', estate => 'd' + estate['day']]]),
((base, filter, hasmod) => (primes => (e, estate) => { e.innerHTML += ' prime=' + primes.next ().value; }) (function* () { for (let p = base (2), x = p.next ().value; ; p = filter (hasmod (x), p), x = p.next ().value) { yield x; } } ())) (function* (start) { for (let x = start; ; x++) { yield x; } }, function* (pred, iter) { for (let x = iter.next (); !x.done; x = iter.next ()) { if (pred (x.value)) { yield x.value; } } }, div => x => x % div != 0),
((chars, n) => (narray => (e, estate) => (pick => { e.innerHTML = pick.join (' ') + ' ' + e.innerHTML + ' ' + pick.reverse ().join (' '); }) (narray.map (k => chars [Math.floor (chars.length * Math.random ())]).map (s => '&#x' + s + ';'))) (Array.from (Array (n).keys ()))) ('2619 2661 2665 2763 2764 2765 2766 2767 2E96 2E97 2F3C 1F0B1 1F0B2 1F0B3 1F0B4 1F0B5 1F0B6 1F0B7 1F0B8 1F0B9 1F0BA 1F0BB 1F0BC 1F0BD 1F0BE 1F394 1F491 1F493 1F494 1F495 1F496 1F497 1F498 1F499 1F49A 1F49B 1F49C 1F49D 1F49E 1F49F 1F5A4 1F60D 1F63B'.split (' '), 5),
((step, paren) => ((gcd, show) => (e, estate) => ((a, b) => { e.innerHTML += '<br/>' + show (a, b, gcd (a, b)); }) (estate['buttonnum'], estate['diecount'])) ((a, b) => { const state = [a, b, 1, 0, 0, 1]; while (state[1] != 0) { step (state); } return [state[0], state[2], state[3]]; }, (a, b, [g, x, y]) => ['gcd = ', g, ' = ', paren (x), '*', a, ' + ', paren (y), '*', b].join (''))) (state => { const [a, b, fa, fb, ga, gb] = state; const m = a % b, d = (a - m) / b; state[0] = b; state[1] = m; state[2] = ga; state[3] = gb; state[4] = fa - d * ga; state[5] = fb - d * gb; }, a => a < 0 ? '(' + a + ')' : a.toString ()),
((sortend, minover, swap) => (next => (e, estate) => { e.parentNode.children [0].innerHTML += ' nextperm=' + next (Array.from (estate['posttime'].replace (/\D/g, ''))).join (''); }) (arr => { if (arr.length < 2) { return arr; } for (let k = arr.length - 2; k >= 0; k--) { let over = minover (arr, k); if (over >= 0) { return sortend (swap (arr, k, over + k + 1), k + 1); } } return arr.sort (); })) ((arr, pos) => { arr.splice (pos, arr.length - pos, ...arr.slice (pos).sort ()); return arr; }, (arr, pos) => arr.slice (pos + 1).reduce ((acc, item, idx, sli) => (arr [pos] < item) && ((acc < 0) || (item < sli [acc])) ? idx : acc, -1), (arr, a, b) => { let x = arr [a]; arr [a] = arr [b]; arr [b] = x; return arr; }),
])