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.List | |
import Data.Char | |
import qualified Data.Map as Map | |
import qualified Data.Set as Set | |
factorial n = product [1..n] | |
dublist x = x ++ x | |
double x = x + x | |
quadruple x = (double . double) x | |
average ns = sum ns `div` length ns |
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
04:22 < walt> hahaha, I love whem vim help talks about performance.. Can tell when it was originally written | |
04:22 < walt> "Vim does on-the-fly spell checking. To make this work fast the word list is | |
04:22 < walt> oh gosh | |
04:22 < dawik> i use airline. its pretty nice | |
04:22 < walt> loaded in memory. Thus this uses a lot of memory (1 Mbyte or more)." | |
04:22 < gfixler> dawik: me too | |
04:22 -!- bandini [~michele@97e50b0e.skybroadband.com] has quit [Ping timeout: 260 seconds] | |
04:22 < mozzarella> I just want a line that tells me the current buffer number and the total number of buffers | |
04:23 < mozzarella> does airline do that? | |
04:23 < gfixler> QED - the Quick EDitor was created at the University of California at Berkeley in the late 60s |
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
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! |
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
# The gitup function lets you type `gitup` from anywhere | |
# in a repo to upload it to your server. It also sets it | |
# up as an origin remote in the local repo. This is meant | |
# to be used in a new repo that has no server version yet. | |
# Note: I have the gitup function in my ~/.bashrc file. | |
# Modify these two 'example.com' vars as needed: | |
gitup_scp='example.com:git' | |
gitup_root='ssh://example.com/~/git/' |
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.List ( transpose ) | |
import Data.Monoid ( Monoid, mempty, mappend ) | |
import System.IO ( BufferMode(NoBuffering) | |
, hSetBuffering, hSetEcho | |
, stdin, stdout, getChar | |
) | |
import Control.Monad ( forM_ ) | |
newtype StdVal = StdVal Int deriving (Eq) | |
type Board 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
Here's a purely-functional take on collecting rolls (no scoring yet) | |
First a data type to represent the 4 states a frame can be in: | |
> data Frame = Roll Int | Open Int Int | Spare Int | Strike deriving (Show) | |
This just simplifies bounds-checks on input roll values: | |
> badnum :: Int -> Bool | |
> badnum n = n < 0 || n > 10 |
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 Control.Applicative ((<|>)) | |
type Bonus = Int | |
data Frame = Roll Int | Frame Int Int | Spare Int | Strike deriving (Show) | |
badnum :: Int -> Bool | |
badnum n = n < 0 || n > 10 | |
strike, spare, frame :: [Int] -> Maybe (Frame, Bonus, [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
import Data.List (sortBy) | |
import Data.Ord (comparing) | |
import qualified Data.Map as M (Map, fromList) | |
data Freq a = V Int a | B Int (Freq a) (Freq a) deriving (Show) | |
size :: Freq a -> Int | |
size (V n _) = n | |
size (B n _ _) = n |
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
bottles :: Int -> String | |
bottles x | x == 0 = "No more bottles" | |
| x == 1 = "1 more bottle" | |
| x < 13 = show x ++ " more bottles" | |
| otherwise = show x ++ " bottles" | |
verse :: Int -> String | |
verse x = line1 ++ "\n" ++ line2 ++ "\n\n" | |
where line1 = bottles x ++ obotw ++ " " ++ bottles x ++ ob | |
line2 = todpia ++ bottles (x-1) ++ obotw |
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
data MyState s a = MyState (s -> (a, s)) | |
get :: MyState s s | |
get = undefined | |
put :: s -> MyState s () | |
put = undefined | |
modify :: (s -> s) -> MyState s () | |
modify = undefined |