Skip to content

Instantly share code, notes, and snippets.

View emilypi's full-sized avatar
🥝
hot girl summer

Emily Pillmore emilypi

🥝
hot girl summer
View GitHub Profile
@emilypi
emilypi / fold_Fix.scala
Last active September 6, 2017 01:07
Cata's, Phi's, Mu's Oh My's
package com.emilypi.scalaupnorth.fold
/**
* Created by emilypi on 5/18/17.
*/
case class Mu[F[_]](unFix: F[Mu[F]])
import scala.annotation.tailrec
/**
* Created by emilypi on 5/17/17.
*/
trait Stream[+A] {
import Stream._
def head: () => A
@emilypi
emilypi / Kinds.scala
Last active May 8, 2017 07:17
Higher-Functors of degree 0-3. Natural transformations are lax 2-Functors. Modifications lax 3-Functors
package misc
import scala.language.higherKinds
import scala.util.{Try, Success}
import scala.annotation.tailrec
object Kinds extends App {
trait Functor[F[_]] {
@emilypi
emilypi / TaggedUnion.sc
Created February 7, 2017 19:33
Generating fully qualified class instance from Tagged Union types with an associated Generator
trait Instantiator[+A] {
def apply(): A
}
object Instantiator {
def apply[A](create: => A): Instantiator[A] = new Instantiator[A] {
def apply(): A = create
}
}
@emilypi
emilypi / Either.java
Created July 2, 2015 02:33
Work samples
package functionaljava.Data;
import functionaljava.Data.List;
import java.util.function.*;
abstract interface Either<A, B> {
abstract <T> T foldEither(final Function<? super A, ? extends T> f, Function<? super B,? extends T> g);
abstract List<Either<A, B>> lefts(List<Either<A, B>> xs);
@emilypi
emilypi / SkipList.java
Created May 13, 2015 03:35
Evidence that I'm not lost in the world of bananas, envelopes, lenses and barbed wire.
package interviewDS;
/**
* @author EmilyPillmore
*
* Naive base indexed implementation of the SkipList data structure
* Average Worst case
* Space O(n) O(n log n)
* Search O(log n) O(n)
* Insert O(log n) O(n)