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 Data.Char | |
import Data.Map (Map, keys, fromList, toList, adjust) | |
import qualified Data.Map | |
import Data.Maybe | |
import Data.List (intercalate) | |
data Cell = StrConst String | | |
Empty | | |
Number Int | | |
Expr String | |
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 Data.Bits | |
import Data.Word | |
import System.Random | |
mtN = 624 | |
mtM = 397 | |
data MersenneTwister = MersenneTwister [Word32] Int | |
deriving Show |
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 Main where | |
import Control.Monad.State | |
import Data.Word | |
type Counter = Word64 | |
type MyState = State Counter | |
mergesort :: (a -> a -> Ordering) -> [a] -> MyState [a] | |
mergesort cmp = mergesort' cmp . map wrap |
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 Main where | |
import Codec.Digest.SHA | |
import Control.Monad | |
import Data.Bits | |
import Data.ByteString as BS(ByteString, last, init, pack, unpack) | |
import Data.HashTable as H | |
import Data.Int | |
import Data.Maybe | |
import Data.Word |
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
С созданием таблицы как new | |
4,068,203,620 bytes allocated in the heap | |
464,278,756 bytes copied during GC | |
196,619,868 bytes maximum residency (11 sample(s)) | |
8,628,244 bytes maximum slop | |
323 MB total memory in use (0 MB lost due to fragmentation) | |
Generation 0: 5565 collections, 0 parallel, 34.72s, 34.86s elapsed | |
Generation 1: 11 collections, 0 parallel, 1.16s, 1.27s elapsed |
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
type JSlice = JudyL Int | |
type JAll = JudyL JSlice | |
jinsert :: Word64 -> Int-> JAll -> IO () | |
jinsert hv src ht = do | |
sl <- slice | |
insert keyl src sl | |
where | |
(keyh, keyl) = hilo hv | |
slice = do |
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
5,569,024,484 bytes allocated in the heap | |
4,241,345,748 bytes copied during GC | |
188,880,976 bytes maximum residency (32 sample(s)) | |
1,712,696 bytes maximum slop | |
504 MB total memory in use (0 MB lost due to fragmentation) | |
Generation 0: 8811 collections, 0 parallel, 8.56s, 8.57s elapsed | |
Generation 1: 32 collections, 0 parallel, 4.10s, 4.51s elapsed | |
INIT time 0.00s ( 0.00s elapsed) |
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
5,366,256,252 bytes allocated in the heap | |
3,725,456 bytes copied during GC | |
2,664,388 bytes maximum residency (3 sample(s)) | |
86,768 bytes maximum slop | |
5 MB total memory in use (0 MB lost due to fragmentation) | |
Generation 0: 8444 collections, 0 parallel, 1.44s, 1.44s elapsed | |
Generation 1: 3 collections, 0 parallel, 0.00s, 0.00s elapsed | |
INIT time 0.00s ( 0.00s elapsed) |
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 Main where | |
import Debug.Trace | |
import Control.Applicative | |
import Control.Monad | |
{-- recursive descent parser for grammar S -> baSab ∣ baS ∣ b --} | |
term :: Char -> String -> Maybe String | |
term _ [] = Nothing |
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 LangParser(parseGrammar, Token(..)) where | |
import Control.Applicative | |
import Control.Monad | |
data Token = | |
Return | | |
Simple Char | | |
OctalConst String | | |
DecimalConst String | |
OlderNewer