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 OverloadedStrings #-} | |
| module Main where | |
| import Control.Monad (when) | |
| import qualified Data.Vault.Lazy as Vault | |
| import Data.ByteString.Char8 (ByteString, pack) | |
| import Data.ByteString.Lazy.Char8 (fromStrict) | |
| import Data.Text (Text) |
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 | |
| import Data.List.Extra | |
| import Data.Maybe (mapMaybe) | |
| import System.Random (randomRIO) | |
| import qualified Data.IntMap as IntMap | |
| import Data.Foldable (for_) | |
| import qualified Data.Map as Map | |
| kmeans :: Ord b => (a -> a -> b) -> ([a] -> a) -> Int -> Int -> [a] -> IO [[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
| resolver: lts-3.19 | |
| packages: | |
| - '.' | |
| - location: | |
| git: git@github.com:bos/hdbc-mysql.git | |
| commit: d43ea057019ff683f278f36af410f4d3cbc731bc | |
| extra-deps: | |
| - relational-record-0.1.2.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
| ```bash | |
| $ brew update | |
| ``` | |
| ##Scalaのインストール | |
| ```bash | |
| $ brew install scala | |
| $ brew install sbt | |
| ``` |
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 (sortOn) | |
| import qualified Data.MultiSet as MultiSet | |
| main :: IO () | |
| main = do | |
| contents <- concat . map words . lines <$> readFile "dagon.txt" | |
| mapM_ print . take 10 . reverse . sortOn snd . MultiSet.toOccurList . MultiSet.fromList $ contents |
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
| flags: {} | |
| packages: | |
| - '.' | |
| extra-deps: | |
| - GLURaw-1.5.0.2 | |
| - GLUT-2.7.0.3 | |
| - JuicyPixels-util-0.2 | |
| - ObjectName-1.1.0.0 | |
| - OpenGL-2.12.0.1 | |
| - OpenGLRaw-2.5.5.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
| import GHC.Int | |
| validateMyNumber :: Int64 -> Bool | |
| validateMyNumber myNumber | |
| | length (show myNumber) <= 12 = | |
| let (x:pn) = take 12 . map (`mod` 10) . iterate (`div` 10) $ myNumber | |
| qn = [if n <= 6 then n + 1 else n - 5 | n <- [1..11]] | |
| y = (`mod` 11) . sum . zipWith (*) qn $ pn | |
| in x == if y <= 1 then 0 else (11 - y) | |
| | otherwise = False |
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 Control.Monad.Trans.Maybe | |
| import Control.Monad.IO.Class | |
| import Data.List | |
| env :: [(String, Int)] | |
| env = [("x", 1), ("y", 2), ("z", 3)] | |
| main :: IO () | |
| main = do | |
| result <- runMaybeT $ do |
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
| resolver: lts-3.11 | |
| packages: | |
| - '.' | |
| extra-deps: | |
| - HDBC-2.4.0.1 | |
| - HDBC-session-0.1.0.0 | |
| - names-th-0.1.0.1 | |
| - persistable-record-0.1.0.1 | |
| - relational-schemas-0.1.0.2 | |
| - sql-words-0.1.3.1 |