Instantly share code, notes, and snippets.

# Harrison Brownhrb90

• Sort options
Last active Jan 6, 2018
arc/segment intersection in javascript
View arc_segment_intersection.js
 // returns an array of real solutions to the quadratic ax^2 + bx + c = 0 const quadratic = (a, b, c) => { if (a === 0) return [ -c/b ]; const discriminant = b*b - 4*a*c; if (discriminant < 0) { return []; } else { const y = - b / (2 * a); const x = Math.sqrt(discriminant) / (2 * a); return [y + x, y - x];
Last active Jan 3, 2018
What's an anagram of Banach-Tarski? Banach-Tarski Banach-Tarski.
View banach-tarski.purs
 module BanachTarski where import Prelude import Data.Foldable (and, foldr) import Data.Group.Free (FreeGroup(..), Signed(..), free) import Data.List ((:)) import Data.Tuple (Tuple, snd) import Math (Radians, acos, cos, sin)
Created Dec 2, 2017
View hutton.purs
 module Main where import Prelude hiding (between) import Control.Monad.Eff (Eff) import Data.Array (foldr, many, reverse, some, uncons) import Data.Bifunctor (lmap) import Data.Either (Either) import Data.Functor (voidRight) import Data.Maybe (Maybe(..))
Last active Nov 15, 2017 — forked from tel/ProfunctorLens.js
Pure Profunctor Lenses in ES6
View ProfunctorLens.js
 /** * Lens types. * =========== * * a * b = {fst: a, snd: b} * a + b = {index: Boolean, value: a | b} * * Iso s t a b = forall (~>) . Profunctor (~>) => (a ~> b) -> (s ~> t) * Lens s t a b = forall (~>) . Strong (~>) => (a ~> b) -> (s ~> t) * Prism s t a b = forall (~>) . Choice (~>) => (a ~> b) -> (s ~> t)
Last active Nov 7, 2017
purescript-by-example chapter 9 lsystem problem 1
View purescript-confusion.purs
 module Example.LSystem where import Prelude import Control.Monad.Eff (Eff) import Data.Array (foldM) import Data.Maybe (Maybe(..)) import Graphics.Canvas (CANVAS, closePath, fillPath, getCanvasElementById, getContext2D, lineTo, moveTo, setFillStyle, setStrokeStyle, strokePath) import Math as Math import Partial.Unsafe (unsafePartial)
Last active Sep 1, 2017