This file contains hidden or 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
function TM(tape, alphabet, states, start){ | |
var state, transition, symbol, | |
counter = 0, stateId = start, pos = 0; | |
while(true){ | |
symbol = tape[pos]; | |
if(typeof symbol === 'undefined'){ | |
symbol = alphabet[0]; | |
tape[pos] = symbol; | |
} | |
state = states[stateId]; |
This file contains hidden or 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 clauses = new Symbol(); | |
function Multimethod(){ | |
const self = !!new.target ? this : Object.create(Multimethod.prototype); | |
self[clauses] = []; | |
return new Proxy(self,{ | |
apply: function(target, thisArg, args){ | |
let curImpl = () => throw new Error("No Matching Implementation"); | |
let curLen = -1; | |
for(const { thisPredicate, predicates, impl } of self[clauses]){ |
This file contains hidden or 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 beamcoder from 'beamcoder'; | |
import { Readable, Writable } from 'stream'; | |
async function * transform(demuxer: beamcoder.Demuxer) { | |
const vdec = beamcoder.decoder({ name: 'h264' }); | |
const adec = beamcoder.decoder({ name: 'aac' }); | |
const venc = beamcoder.encoder({ name: 'h264' }); | |
const aenc = beamcoder.encoder({ name: 'aac' }); |
OlderNewer