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 LinearSelection where | |
import System.Random (randomRIO) | |
import System.IO.Unsafe (unsafePerformIO) | |
select :: Ord a => [a] -> Int -> a | |
select [x] 1 = x | |
select xs n | |
| n > length xs || n <= 0 = error $ "select: wrong index (" ++ show n ++ ") where length is " ++ show (length xs) | |
| length ls < n = select bs (n - length ls) |
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 UnicodeSyntax #-} | |
module Queue | |
( Queue | |
, isEmpty | |
, ($*), head, tail | |
, size | |
, fromList | |
) where | |
import Data.List (foldl') |
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 UnicodeSyntax #-} | |
module Main (main) where | |
import Control.Applicative ((<$>)) | |
import Control.Monad (foldM, when) | |
import Control.Monad.ST (ST) | |
import Control.Parallel (par) | |
import Data.Array (elems) | |
import Data.Array.ST (STArray, newListArray, readArray, runSTArray, writeArray) | |
import Data.Char (toUpper) |
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 TemplateHaskell #-} | |
module Pisya where | |
import PisyaTH | |
$(anal ["pemis", "gnoi", "sosiska", "sobachka"]) |
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 UnicodeSyntax #-} | |
module NFA | |
( single, (×), (⧺), star | |
) where | |
import Data.Maybe (fromMaybe, mapMaybe) | |
import Prelude hiding (concat) | |
import qualified Prelude | |
data NFA p = NFA { match ∷ (p → Maybe [p]) } |
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 UnicodeSyntax #-} | |
module Main where | |
import Control.Monad (replicateM) | |
import Data.Functor ((<$>)) | |
import Data.IntMap (IntMap, (!)) | |
import Data.Maybe (fromJust) | |
import System.Environment (getArgs) | |
import System.Random (randomRIO) | |
import qualified Data.IntMap as IM |
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
#!/usr/bin/env runhaskell | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Control.Applicative ((<$>)) | |
import Control.Monad ((<=<)) | |
import Data.List (intercalate) | |
import System.Environment (getArgs) | |
import Distribution.ModuleName (components) | |
import Distribution.PackageDescription (condLibrary, condTreeData, libModules) |
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 UnicodeSyntax #-} | |
import Data.Char (chr) | |
import Text.Printf (printf) | |
import Data.List.Split (chunk) | |
import Data.Number.CReal (CReal) | |
main ∷ IO () | |
main = |
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 UnicodeSyntax #-} | |
import Control.Monad (foldM_, join) | |
import qualified Data.HashMap.Lazy as H | |
b ∷ Int | |
b = 1048576 | |
p ∷ Integer |