This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bindConstructor = (f) => { | |
const f_ = f | |
return function (...args) { | |
if (new.target !== f_) { | |
return new f_(...args) | |
} | |
} | |
} | |
const effect = () => console.log("instantiated another one...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Recursive "find and replace". | |
* | |
* TODO: Treat tuples differently than arrays so we don't | |
* lose type information when replacing, e.g.: | |
* ``` | |
* S extends [UnsafeAny] ? // ... | |
* S extends [UnsafeAny, UnsafeAny] ? // ... | |
* ``` | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'GDAuth', | |
initial: 'idle', | |
context: { | |
user: null | |
}, | |
states: { | |
idle: { | |
on: { | |
TEST_EXECUTION_ENV: 'ssr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lightweight higher-kinded polymorphism | |
Jeremy Yallop and Leo White | |
University of Cambridge | |
Abstract. Higher-kinded polymorphism —i.e. abstraction over type constructors— is an essential component of many functional programming | |
techniques such as monads, folds, and embedded DSLs. ML-family languages typically support a form of abstraction over type constructors | |
using functors, but the separation between the core language and the | |
module language leads to awkwardness as functors proliferate. | |
We show how to express higher-kinded polymorphism in OCaml without functors, using an abstract type app to represent type application, | |
and opaque brands to denote abstractable type constructors. We demonstrate the flexibility of our approach by using it to translate a variety of | |
standard higher-kinded programs into functor-free OCaml code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno --allow-net | |
const { args, stat, readdir, open, exit } = Deno; | |
import { contentType } from "../media_types/mod.ts"; | |
import { posix, extname } from "../path/mod.ts"; | |
import { listenAndServe, ServerRequest, Response } from "./server.ts"; | |
import { parse } from "../flags/mod.ts"; | |
import { assert } from "../testing/asserts.ts"; | |
import { setContentLength } from "./io.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { listenAndServe } from 'https://deno.land/std/http/server.ts' | |
const body: string = ` | |
🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭 | |
🌴🌴🌴 I'M ALLERGIC TO MANGOS 🌴🌴🌴 | |
🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭 | |
` | |
const options = { port: 8000 }; | |
listenAndServe(options, (req) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" DOTFILES: https://github.com/ahrjarrett/dotfiles {{{ | |
" Author: Andrew Jarrett | |
" Email: <ahrjarrett@gmail.com> | |
" }}} | |
" Dein: {{{ | |
if (!isdirectory(expand("$HOME/.config/nvim/repos/github.com/Shougo/dein.vim"))) | |
call system(expand("mkdir -p $HOME/.config/nvim/repos/github.com")) | |
call system(expand("git clone https://github.com/Shougo/dein.vim $HOME/.config/nvim/repos/github.com/Shougo/dein.vim")) | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on Gabriel Lebec's excellent talk on Lambda Calculus | |
// https://www.youtube.com/watch?v=3VQ382QG-y4 | |
let { log } = console | |
I = a => a | |
M = f => f(f) | |
K = a => b => a | |
KI = a => b => b | |
C = f => a => b => f(b)(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// p. 55: learning js data structures & algorithms, 2nd ed. | |
// Let's create a 3 x 3 matrix: | |
let matrix3x = []; | |
for (let i = 0; i < 3; i++) { | |
matrix3x[i] = []; | |
for (let j = 0; j < 3; j++) { | |
matrix3x[i][j] = []; | |
for (let z = 0; z < 3; z++) { | |
matrix3x[i][j][z] = i + j + z; |