Skip to content

Instantly share code, notes, and snippets.

View awonnacott's full-sized avatar
💭
🚁

Andrew Wonnacott awonnacott

💭
🚁
View GitHub Profile
@awonnacott
awonnacott / setup_functional_windows.md
Last active April 26, 2019 15:59
Setup for OCaml and F# for Windows

Setup for Functional Programming on Windows

We use two functional programming languages in COS 326 course: OCaml and F#.

Installing OCaml

OPAM is the package manager for OCaml. It is the recommended way to install the OCaml compiler and OCaml packages. -OCaml installation instructions

Once Opam is installed, the same instructions work on all platforms. But the installation of Opam will work differently on different operating systems.

@awonnacott
awonnacott / train_to_the_plane.md
Last active September 14, 2019 02:36
Public transit from Princeton University to area airports

Overview

This document provides an outline for how to use public transportation to get between Princeton University and area airports.

  1. Summary table for airport travel
  2. Reference for modes of transit
    • NJ Transit and SEPTA rail services
    • Amtrak rail services
    • Coach bus
    • NJ Transit bus
  • TigerTransit bus
the following is my preferred defintion of monad
a monad M requires the following three functions, along with their names (programmers, mathematicians):
a -> M a ("singleton" or "unit")
M M a -> M a ("flatten" or "multiplication")
(a -> b) -> (M a -> M b) ("map", no name its deifnition is given by the definition of unit)
such that, where m : M a and mmm : M M M a:
flatten (map singleton m) = m = flatten (singleton m)
flatten (flatten mmm) = flatten (map flatten mmm)
and calling them map, flatten, and singleton makes it easy to see how a lot of data structures are monads
@awonnacott
awonnacott / format.hs
Last active May 2, 2017 23:33
Haskell version of formatter code using ByteStrings instead of [Chars]
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
main :: IO ()
main = B.getContents >>=
(mapM_ C.putStrLn) . map (C.intercalate (C.singleton ' ')) . (fmt 0 []) . (map C.words) . (C.split '\n')
fmt :: Int -> [B.ByteString] -> [[B.ByteString]] -> [[B.ByteString]]
-- Empty file
fmt _ [] [] = []
@awonnacott
awonnacott / keybase.md
Created October 27, 2016 23:44
Keybase proof

Keybase proof

I hereby claim:

  • I am awonnacott on github.
  • I am awonnacott (https://keybase.io/awonnacott) on keybase.
  • I have a public key ASDVAyn17F5fA6gISJoEbl-E91l4uVZOeOmDLG_ORjeq_Ao

To claim this, I am signing this object: