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
| (use math.mt-random) | |
| (define (random-maker) | |
| (let ((m (make <mersenne-twister> :seed (sys-time)))) | |
| (lambda () (mt-random-integer m 2)))) | |
| (define random1 (random-maker)) | |
| (define (random a b) | |
| (let ((count (- b a))) | |
| (+ a (let loop ((count count) | |
| (num 0)) |
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 Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Text.Printf | |
| import Data.Function (on) | |
| import Data.Maybe | |
| import qualified Data.Tree as T | |
| import qualified Data.Map as M | |
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
| {-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-} | |
| {-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-} | |
| {-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-} | |
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| module Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Text.Printf |
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
| {-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-} | |
| {-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-} | |
| {-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-} | |
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| module Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Text.Printf |
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 Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Text.Printf | |
| import Data.Function (on) | |
| import Data.Maybe | |
| import qualified Data.Tree as T | |
| import qualified Data.Map as M | |
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 Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Text.Printf | |
| import Data.Time | |
| import Data.Time.Calendar | |
| import Text.Printf | |
| import Data.Maybe | |
| splitBy :: (a -> Bool) -> [a] -> [[a]] |
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
| {-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-} | |
| {-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-} | |
| {-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-} | |
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| module Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Data.Function (on) | |
| import Text.Printf | |
| import Control.Monad |
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
| type L x = Array Int (x,Int) | |
| combine :: Num x => L x -> L x -> L x | |
| combine lut1 lut2 = listArray (bounds lut1) [let (p1,s1) = lut1!i; (p2,s2) = lut2!s1 in (p1+p2,s2) | | |
| i <- range (bounds lut1)] | |
| times :: Num x => Integer -> L x -> L x | |
| times 0 lut = listArray (bounds lut) [(0,x) | x <- range (bounds lut)] | |
| times 1 lut = lut | |
| times 2 lut = combine lut lut |
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
| {-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math -cpp #-} | |
| {-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-} | |
| {-# LANGUAGE BangPatterns, OverloadedStrings, ScopedTypeVariables #-} | |
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| module Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Data.Function (on) | |
| import Text.Printf | |
| import Control.Monad |
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
| {-# LANGUAGE CPP #-} | |
| {-# OPTIONS_GHC -O2 -optc-O3 -optc-ffast-math#-} | |
| {-# OPTIONS_GHC -funbox-strict-fields -fexcess-precision -monly-3-regs #-} | |
| {-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} | |
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| module Main where | |
| import Control.Applicative | |
| import Data.List | |
| import Data.Function (on) | |
| import Text.Printf |