One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
import { useState } from 'react'; | |
export function useCounter(initial = 0) { | |
const [count, setCount] = useState(initial); | |
return [count, () => setCount(count + 1)]; | |
} |
var noop = () => {} | |
var compose = (f1, f2) => (...args) => f1(f2(...args)) | |
var range = (start, end) => { | |
let n = start | |
let f = (next, complete) => { | |
if (n <= end) { | |
next(n++) | |
f(next, complete) | |
} else { | |
complete() |
/// | |
/// Factorial function in lambda calculus - implemented in JS | |
/// | |
//// Lambda calculus | |
// zero = λs.λz.z | |
// succ = λn.λs.λz.s (n s z) | |
// mult = λn.λm.λs.m (n s) | |
// pred = λn.λf.λx.n(λg.λh.h (g f))(λu.x)(λu.u) | |
// minus = λn.λm.m pred n |
function navigate(nmbrInt, roads, from, to) { | |
const getRoad = (from, to, roads) => roads.filter((e) => e.from == from && e.to == to)[0]; | |
const getIntersections = (roads) => roads.reduce((r, e) => r.concat([e.from, e.to]), []).filter((e, i, a) => a.indexOf(e) === i); | |
const permutator = function(inputArr, from, to) { | |
var r = []; | |
var permute = function(arr, memo) { | |
var cur, memo = memo || []; | |
for (var i = 0; i < arr.length; i++) { | |
cur = arr.splice(i, 1); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.