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
| :- op(500, xfy, $). | |
| :- op(499, xfy, o). | |
| apply(F, X, Result) :- | |
| member(Case, F), | |
| copy_term(Case, X -> Result), | |
| !. | |
| funcall(Expr, F, Xs) :- |
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
| ---- Minecraft Crash Report ---- | |
| // I'm sorry, Dave. | |
| Time: 5/24/15 12:32 PM | |
| Description: Ticking memory connection | |
| java.lang.IllegalArgumentException: Comparison method violates its general contract! | |
| at java.util.TimSort.mergeHi(TimSort.java:868) | |
| at java.util.TimSort.mergeAt(TimSort.java:485) | |
| at java.util.TimSort.mergeForceCollapse(TimSort.java:426) |
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
| package traversal; | |
| import java.util.*; | |
| public class Filter { | |
| public static <A> Iterable<A> array(A[] as, Predicate<A> predicate) { | |
| return Filter.the(new NativeArrayAsIterable<A>(as), predicate); | |
| } | |
| public static <A> Iterable<A> the(Iterable<A> as, Predicate<A> predicate) { |
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 Color exposing (..) | |
| import Dict exposing (..) | |
| import Graphics.Element exposing (..) | |
| import Graphics.Collage exposing (..) | |
| import Keyboard exposing (..) | |
| import Maybe exposing (..) | |
| import Signal exposing (..) | |
| type alias Game = | |
| { player : Point |
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
| :- op(1030, xfx, is). | |
| :- op(1045, yfx, @). | |
| :- op(1040, yfx, after). | |
| :- op(1050, xfy, to). | |
| :- op(1175, xfy, in). | |
| compile | |
| --> simplify | |
| , toJS | |
| , ! |
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
| def list_induction list, stop, step, ret | |
| return stop.(ret) if list.empty? | |
| x = list.shift | |
| return list_induction list, stop, step, -> (args) { | |
| step.(x, args, ret) | |
| } | |
| end | |
| list_induction [1,2,3,4,5], |
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 Data.List (foldl') | |
| avg list = | |
| let (count, sum) = foldl' collect (0, 0) list | |
| in fromIntegral sum / count | |
| where | |
| collect (count, sum) item = | |
| count `seq` |
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 Data.List (sortBy) | |
| import Data.Function (on) | |
| merge :: [(Int, a)] -> [(Int, b)] -> [(Maybe a, Maybe b)] | |
| merge az bz = case (az, bz) of | |
| ((i, a) : az', (j, b) : bz') -> | |
| case i `compare` j of | |
| LT -> (Just a, Nothing) : merge az' bz | |
| EQ -> (Just a, Just b) : merge az' bz |
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 Data.List (permutations) | |
| import Control.Monad (guard) | |
| main = putStrLn $ head solutions | |
| solutions = do | |
| let range = [0.. 9] | |
| [s,e,n,d,m,o,r,y,_,_] <- permutations range |
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
| --module MyZipper | |
| -- ( File() | |
| -- , Position | |
| -- , up | |
| -- , downAtLeft | |
| -- , downAtRight | |
| -- , left | |
| -- , right | |
| -- , comeIn |