Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
geo2a committed Nov 1, 2017
0 parents commit 8f3221f
Show file tree
Hide file tree
Showing 18 changed files with 4,514 additions and 0 deletions.
211 changes: 211 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2

## Intermediate documents:
.dvi
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
*.eps
*.pdf

## Generated if empty string is given at "Please type another file name for output:"
.pdf

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.brf
*.run.xml

## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync

## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa

# achemso
acs-*.bib

# amsthm
*.thm

# beamer
*.nav
*.pre
*.snm
*.vrb

# cprotect
*.cpt

# endnotes
*.ent

# fixme
*.lox

# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
*.[1-9]
*.[1-9][0-9]

#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R

# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs

# gnuplottex
*-gnuplottex-*

# gregoriotex
*.gaux
*.gtex

# hyperref
*.brf

# knitr
*-concordance.tex
# TODO Comment the next line if you want to keep your tikz graphics files
*.tikz
*-tikzDictionary

# listings
*.lol

# makeidx
*.idx
*.ilg
*.ind
*.ist

# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*

# minted
_minted*
*.pyg

# morewrites
*.mw

# mylatexformat
*.fmt

# nomencl
*.nlo

# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd

# scrwfile
*.wrt

# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/

# pdfcomment
*.upa
*.upb

# pythontex
*.pytxcode
pythontex-files-*/

# thmtools
*.loe

# TikZ & PGF
*.dpth
*.md5
*.auxlock

# todonotes
*.tdo

# easy-todo
*.lod

# xindy
*.xdy

# xypic precompiled matrices
*.xyc

# endfloat
*.ttt
*.fff

# Latexian
TSWLatexianTemp*

## Editors:
# WinEdt
*.bak
*.sav

# Texpad
.texpadtmp

# Kile
*.backup

# KBibTeX
*~[0-9]*

# auto folder when using emacs and auctex
/auto/*

# expex forward references with \gathertags
*-tags.tex
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
latexmk -pdf -ps- -dvi- -recorder -shell-escape resume.tex

clean:
latexmk -c
21 changes: 21 additions & 0 deletions examples.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Control.Monad.Reader
import Control.Monad.Random.Lazy

type Bracelet = [Bool]

random

xor :: Bool -> Bool -> Bool
True `xor` False = True
False `xor` True = True
_ `xor` _ = False

rotateLeft :: [a] -> [a]
rotateLeft [] = []
rotateLeft (x:xs) = xs ++ [x]

testBracelet :: Bracelet -> Int
testBracelet xs = length . filter id $ zipWith xor xs (rotateLeft xs)

main :: IO ()
main = putStrLn "Hello World!"
3 changes: 3 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.stack-work/
examples.cabal
*~
42 changes: 42 additions & 0 deletions examples/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{-# LANGUAGE FlexibleContexts #-}

module Main where

import Data.List
import Control.Monad.Reader
import Control.Monad.Random.Lazy
import Control.Monad.Random.Class
import System.Random.Shuffle

type Survivor = Int

type Group = [Survivor]

-- | Survivors keep watch in pairs
type Shift = (Survivor, Survivor)

-- | One night's schedule has three shifts
type Schedule = (Shift, Shift, Shift)

-- | An infinite stream of random possible shifts
shifts :: (MonadReader Group m, MonadRandom m) => m [Shift]
shifts = concat . repeat <$> step
where step = do
people <- ask
possibleShifts <- shuffleM $ pairs people
pure possibleShifts

pairs :: [a] -> [(a, a)]
pairs l = [(x,y) | (x:ys) <- tails l, y <- ys]

-- | Construct a randomised schedule
buildSchedule :: (MonadReader Group m, MonadRandom m) => m Schedule
buildSchedule = do
[x, y, z] <- take 3 <$> shifts
pure $ (x, y, z)

main :: IO ()
main = do
let people = [1..5]
schedule <- evalRandTIO (runReaderT buildSchedule people)
putStrLn $ "Watch schedule for this night: " ++ show schedule
31 changes: 31 additions & 0 deletions examples/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Try out the zombie examples from the talk.

## Haskell

To build project end run examples you need to have the Haskell [Stack](https://docs.haskellstack.org/en/stable/README/) tool installed.

Fire up an interactive session:

```
stack ghci
```

Run the `main` function:

```
ghci> :main
```

## C++

Compile the program:

```
gcc zombies.cpp -std=c++11 -o zombies
```

Run the program:

```
./zombies
```
66 changes: 66 additions & 0 deletions examples/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-9.11

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# extra-dep: true
# subdirs:
# - auto-update
# - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps: []

# Override default flag values for local packages and extra-deps
flags: {}

# Extra package databases containing global packages
extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.5"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
Loading

0 comments on commit 8f3221f

Please sign in to comment.