[ Launch: proba ] 037ea62c55b3be75628b1ef7c6b40658 by alvare
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
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE LambdaCase #-} | |
module Lib | |
( someFunc | |
) where | |
import Data.Char | |
import Data.IORef | |
import System.IO |
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 | |
data Ball = R | B deriving (Show, Eq) | |
data Coin = Ca | Ce deriving (Show, Eq) | |
s_a = [(Ca, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l] | |
where l = [R, R, R, R, B, B] | |
s_e = [(Ce, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l] |
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
-- stack --resolver lts-5.8 runghc --package "aeson scalpel bytestring text" | |
{-# LANGUAGE LambdaCase #-} | |
module Main where | |
import Control.Monad (forM) | |
import Text.HTML.Scalpel | |
import Data.Aeson | |
import Data.Text (Text, unpack, pack, strip) | |
import qualified Data.Text.IO as T | |
import qualified Data.ByteString.Lazy as B |
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
(ns alphabet-cipher.coder) | |
; Vemos que encodear un caracter `m` con | |
; una letra de keyword `k` es equivalente a sumar sus indices | |
; en el abecedario modulo 26. | |
; | |
; Por ejemplo: con indice("m") = 12 y indice("s") = 18 tenemos | |
; 12 + 18 ≡ 4 (mod 26) | |
; y 4 = indice("e") | |
; |
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.Concurrent.Async.Pool | |
main :: IO () | |
main = do | |
withTaskGroup 5 $ \g -> | |
mapTasks_ g $ map print [1..10] | |
putStrLn "Done!" |
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
# coding: utf-8 | |
import csv | |
import json | |
import numpy as np | |
def r_tree(points, K): | |
""" STR method for building R-Tree like structure. | |
http://stats.stackexchange.com/a/40785 | |
http://www.dtic.mil/dtic/tr/fulltext/u2/a324493.pdf (pag. 8) |
I hereby claim:
- I am alvare on github.
- I am alvare (https://keybase.io/alvare) on keybase.
- I have a public key whose fingerprint is 299F A304 4E77 184C 7831 7E7D A45B 3D40 CF96 B477
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
import Text.Printf | |
import System.CPUTime | |
import qualified Data.Sequence as Seq | |
import Data.Sequence ((><), (<|), (|>)) | |
import Data.Foldable (toList) | |
time :: IO t -> IO t | |
time a = do | |
start <- getCPUTime | |
v <- a |
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 Text.Printf | |
import Control.Exception | |
import System.CPUTime | |
time :: IO t -> IO t | |
time a = do | |
start <- getCPUTime | |
v <- a | |
end <- getCPUTime | |
let diff = (fromIntegral (end - start)) / (10^12) |
NewerOlder