Skip to content

Instantly share code, notes, and snippets.

View kelly-dance's full-sized avatar

Kelly Dance kelly-dance

  • Colorado School of Mines
View GitHub Profile
@kelly-dance
kelly-dance / mandlebrot.js
Last active April 22, 2024 22:17
Mandlebrot thing I did ~2 years ago
// data structures
const trp = a => b => c => f => f(a)(b)(c);
const fst3 = p => p(a => b => c => a);
const snd3 = p => p(a => b => c => b);
const trd3 = p => p(a => b => c => c);
const tup = a => b => f => f(a)(b);
const fst = p => p(a => b => a);
const snd = p => p(a => b => b);
// boolean logic
@kelly-dance
kelly-dance / 06.js
Last active December 6, 2021 10:35
advent 2021 day 6
import { memoize, readAdvent, range, sum } from '../tools.ts';
import * as m from 'https://cdn.skypack.dev/mathjs';
const inp = (await readAdvent()).split(',').map(s => parseInt(s));
// original implementation that I know gets the correct answer
const calc = memoize(remdays => remdays <= 0 ? 1 : calc(remdays - 7) + calc(remdays - 9));
// following along this youtube video
// https://www.youtube.com/watch?v=A5tBvxDM9V4