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 (when) | |
import System.Environment (getArgs) | |
import Data.List (intersperse) | |
fibo :: [Int] | |
fibo = 0 : 1 : zipWith (+) fibo (tail fibo) | |
hotDogsOnDay :: Int -> Int |
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
function fix(f) { | |
return function(x) { | |
return f(x)(fix(f)); | |
} | |
} | |
var fac = function(x) { | |
if(x == 1) { | |
return function(_) { | |
return 1; |
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
# Generated by ffi_gen. Please do not change this file by hand. | |
require 'ffi' | |
module Slurm | |
extend FFI::Library | |
ffi_lib "slurm" | |
def self.attach_function(name, *_) | |
begin; super; rescue FFI::NotFoundError => 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
{-# LANGUAGE RankNTypes #-} | |
import Data.Functor.Identity | |
import Graphics.Gloss | |
-- * types | |
type Lens s a = forall f. Functor f => (a -> f a) -> s -> f s | |
ix :: Int -> Lens [a] 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 System.Environment | |
import Control.Exception | |
import Control.Monad | |
import Network.Socket | |
main = do | |
args <- getArgs | |
case args of | |
[host] -> catch (displayIPs host) $ \e -> do | |
let err = show (e :: IOException) |
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 TupleSections #-} | |
import System.Environment | |
import Control.Monad | |
import qualified Data.Attoparsec.Text as P | |
import Data.Maybe | |
import Data.List | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as TIO | |
import qualified Data.Map as M |
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 ( | |
Trie, | |
empty, | |
fromList, | |
insert, | |
prefixesFor | |
) where | |
import Data.Maybe | |
import Data.List (foldr) |
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 MultiParamTypeClasses, | |
FunctionalDependencies, | |
FlexibleInstances #-} | |
module StateT ( | |
--StateT, runStateT, | |
State, runState, | |
MonadState, | |
module Control.Applicative, | |
module Control.Monad, |
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
-- common | |
data Fix a = Fx (a (Fix a)) | |
unfix :: Fix a -> a (Fix a) | |
unfix (Fx f) = f | |
type Algebra f a = f a -> a | |
cata :: Functor f => (f a -> a) -> Fix f -> 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
module PascalsTriangle (pascalsTriangle) where | |
import Control.Applicative | |
import Test.QuickCheck | |
pascalsTriangle :: [[Int]] | |
pascalsTriangle = [1] : map row pascalsTriangle | |
where row prev = zipWith (+) (0 : prev) (prev ++ [0]) | |
-- quickcheck stuff |
NewerOlder