I hereby claim:
- I am tjweir on github.
- I am tylerweir (https://keybase.io/tylerweir) on keybase.
- I have a public key ASD2xg_3ZsRdGN8ugkjGdFEVflXq-1pdffzrjpGATnI1AQo
To claim this, I am signing this object:
So, let’s flip a coin: if it’s heads, play a drum, if it’s tails, play a cymbal. Easy. We can emulate a coin flip with our one_in function (introduced in the section on randomness) specifying a probability of 1 in 2: one_in(2). We can then use the result of this to decide between two pieces of code, the code to play the drum and the code to play the cymbal: | |
loop do | |
if one_in(2) | |
sample :drum_heavy_kick | |
else | |
sample :drum_cymbal_closed | |
end | |
I hereby claim:
To claim this, I am signing this object:
{-# LANGUAGE RecordWildCards, Arrows #-} | |
import Numeric | |
import Data.Char | |
import Control.Monad | |
import Data.Monoid ((<>)) | |
import Data.List (nub, sort, reverse) | |
data RepeatBounds = RB |
import Control.Applicative | |
import Text.ParserCombinators.ReadP | |
data WindInfo = WindInfo | |
{ dir :: Int | |
, speed :: Int | |
, gusts :: Maybe Int | |
} | |
deriving Show |
import Data.Map.Strict as M | |
import Prelude as P | |
data A = A | |
{ aa :: Int | |
, ab :: Int | |
} deriving (Show) | |
data B = B | |
{ ba :: Int |
"http://emacsredux.com/blog/2013/04/28/switch-to-previous-buffer/" | |
(defun switch-to-previous-buffer () | |
"Switch to previously open buffer. | |
Repeated invocations toggle between the two most recently open buffers." | |
(interactive) | |
(switch-to-buffer (other-buffer (current-buffer) 1))) | |
(global-set-key (kbd "C-c b") 'switch-to-previous-buffer) |
module Main where | |
data Command | |
= QuitApp | |
| DisplayItems | |
| Help | |
| AddItem String | |
| Complete Int | |
type Item = String |
{-# language KindSignatures #-} | |
{-# language PolyKinds #-} | |
{-# language DataKinds #-} | |
{-# language TypeFamilies #-} | |
{-# language RankNTypes #-} | |
{-# language NoImplicitPrelude #-} | |
{-# language FlexibleContexts #-} | |
{-# language MultiParamTypeClasses #-} | |
{-# language GADTs #-} | |
{-# language ConstraintKinds #-} |