Skip to content

Instantly share code, notes, and snippets.

Christopher Elwell celwell

  • Philadelphia, PA
Block or report user

Report or block celwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
celwell / memoize.js
Created Jan 14, 2019
JS function "memoize": Takes a function, f, and returns a memoized version of f.
View memoize.js
// Takes a function, f, and returns a memoized version of f.
// Note: only memoize pure, idempotent functions
var memoize = function (f) {
let store = new Map();
return function (...args) {
const k = JSON.stringify(args);
return (store.has(k) ?
store.get(k) :
store.set(k, f(...args)).get(k));
celwell / Merge Sort in JavaScript.js
Last active Jan 1, 2019
Merge Sort in JavaScript, simple implementation
View Merge Sort in JavaScript.js
// helper fn used by merge_sort; merges two arrays into sorted order
var merge = function (left, right) {
let merged = [],
i = 0, // left array index counter
j = 0; // right array index counter
while (i < left.length && j < right.length) {
if (left[i] < right[j]) {
View Thread-last and first.clj
(-> test-results
(->> (map #(list (:id %) (:prefill_config %))))
(->> (apply hash-map))
(select-keys (map keyword current-form-ids)))
You can’t perform that action at this time.