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 Trie where | |
data Trie a = Node Char (Trie a) (Trie a) (Trie a) (Maybe a) | |
| Empty deriving (Show, Eq) | |
sanify :: Trie a -> Trie a | |
sanify (Node _ Empty Empty Empty Nothing) = Empty | |
sanify (Node _ Empty lo Empty Nothing) = lo | |
sanify (Node _ Empty Empty hi Nothing) = hi | |
sanify t = t |
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
### Keybase proof | |
I hereby claim: | |
* I am utdemir on github. | |
* I am utdemir (https://keybase.io/utdemir) on keybase. | |
* I have a public key whose fingerprint is AC38 11DF 709A 1F3B 4292 6199 C156 E0E6 84DA 5E04 | |
To claim this, I am signing this object: |
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 Stats where | |
import Data.List | |
import Data.Maybe | |
import Data.Time.Clock | |
import Data.Time.Calendar | |
import Network.URL | |
import GHC.Exts |
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
-- Stolen from http://www.haskell.org/haskellwiki/Testing_primality | |
primes :: [Integer] | |
primes = 2: 3: sieve (tail primes) [5,7..] | |
where | |
sieve (p:ps) xs = h ++ sieve ps [x | x <- t, x `rem` p /= 0] | |
where (h,~(_:t)) = span (< p*p) xs | |
isPrime :: Integer -> Bool | |
isPrime n = n > 1 && all (\ p -> n `rem` p /= 0) (takeWhile (\ p -> p*p < n) primes) |
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 System.Environment | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 | |
in r + 10 * binread q |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
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
############################################################# | |
################### OFFICIAL UBUNTU REPOS ################### | |
############################################################# | |
###### Ubuntu Main Repos | |
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse | |
deb-src http://archive.ubuntu.com/ubuntu trusty main | |
###### Ubuntu Update Repos | |
deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse |
OlderNewer