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
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/htmlconverte |
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
package core; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
public class EightQueens { | |
static <A, B> A car(Pair<A, B> pair) { | |
return pair.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
import java.util.function.Supplier; | |
public interface Lazy<T> extends Supplier<T> { | |
static <T> Lazy<T> of(Supplier<T> sup) { | |
return new LazyImpl<T>(sup); | |
} | |
static <T> Lazy<T> ofSafe(Supplier<T> sup) { | |
return new LazyThreadSafe<T>(sup); |
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 java.util.function.Supplier; | |
public interface Lazy<T> extends Supplier<T> { | |
static <T> Lazy<T> of(Supplier<T> sup) { | |
return new LazyImpl<T>(sup); | |
} | |
static <T> Lazy<T> ofSafe(Supplier<T> sup) { | |
return new LazyThreadSafe<T>(sup); |
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 java.util.function.Supplier; | |
public interface Lazy<T> extends Supplier<T> { | |
static <T> Lazy<T> of(Supplier<T> sup) { | |
return new LazyImpl<T>(sup); | |
} | |
static <T> Lazy<T> ofSafe(Supplier<T> sup) { | |
return new LazyThreadSafe<T>(sup); |
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 java.util.function.Supplier; | |
public interface Lazy<T> extends Supplier<T> { | |
static <T> Lazy<T> of(Supplier<T> sup) { | |
return new LazyImpl<T>(sup); | |
} | |
static <T> Lazy<T> ofSafe(Supplier<T> sup) { | |
return new LazyThreadSafe<T>(sup); |
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 java.util.function.Function; | |
import java.util.function.Supplier; | |
interface TailRec<A> { | |
default <B> TailRec<B> map(Function<A, B> f) { | |
return flatmap(x -> new Call<>(() -> new Done<>(f.apply(x)))); | |
} | |
default <B> TailRec<B> flatmap(Function<A, TailRec<B>> f) { | |
if (this instanceof Done) { |
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 java.util.function.Function; | |
import java.util.function.Supplier; | |
interface TailRec<A> { | |
default <B> TailRec<B> map(Function<A, B> f) { | |
return flatmap(x -> new Call<>(() -> new Done<>(f.apply(x)))); | |
} | |
default <B> TailRec<B> flatmap(Function<A, TailRec<B>> f) { | |
if (this instanceof Done) { |
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
package ezksd | |
import ezksd.Parser.parse | |
object Interpreter { | |
type Continuation[T] = T => Unit | |
@inline | |
def cps_map(l: List[Any], f: (Any, Any => Unit) => Unit, k: Continuation[List[Any]]) { |
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
module Parser where | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.Trans.State | |
import Data.Char | |
type Parser a = StateT String Maybe a | |
runParse :: Parser a -> String -> Maybe a | |
runParse p s = do (a,b) <- runStateT p s |
OlderNewer