( ) Red ( ) Green
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
### Keybase proof | |
I hereby claim: | |
* I am tomphp on github. | |
* I am tomoram (https://keybase.io/tomoram) on keybase. | |
* I have a public key ASB2-5Vv65haxi1hqeFEhF4m7z_7WzFpet0w5IID9JXdLAo | |
To claim this, I am signing this object: |
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
from hypothesis import given | |
from hypothesis.strategies import text | |
def reverse(string): | |
return string | |
@given(text()) | |
def test_reverse_reverse_is_the_original(s): | |
assert s == reverse(reverse(s)) |
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
RSpec.describe 'acceptance test' do | |
xit 'works' do | |
runner = CommandRunner.new(Tokenizer.new) | |
expect(runner.run( | |
'I 5 5', | |
'C 1', | |
'V 2 5 3 4', | |
'H 5 1 4 3', | |
'P 4 2 2', |
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
package go_coin_change | |
func ExampleChange(amount uint) []uint { | |
result := []uint{} | |
coins := []uint{10, 5, 2, 1} | |
for _, coin := range coins { | |
for amount >= coin { | |
result = append(result, coin) |
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
%default total | |
data Player = P1 | P2 | |
-- How can we prove that it's not the same player? | |
otherPlayer : Player -> Player | |
otherPlayer P1 = P2 | |
otherPlayer P2 = P1 | |
data PointValue = Love | Fifteen | Thirty | Forty |
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
%default total | |
data Player = P1 | P2 | |
-- How can we prove that it's not the same player? | |
otherPlayer : Player -> Player | |
otherPlayer P1 = P2 | |
otherPlayer P2 = P1 | |
data PointValue = Love | Fifteen | Thirty | Forty |
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
module TennisSpec where | |
import Test.Hspec | |
data Point | |
= Love | |
| Fifteen | |
| Thirty | |
| Forty | |
deriving (Enum, Eq, Show) |
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 InstanceSigs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE GADTs #-} | |
import Control.Monad ((>=>)) | |
{- | |
-- Initial style | |
data Console a = GetLine String (String -> Console 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
{-# LANGUAGE ApplicativeDo #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
module Main where | |
import Control.Lens | |
import Control.Monad ((>=>)) |