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:
I hereby claim:
To claim this, I am signing this object:
| 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 _ [] [] = [] |
| 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 |
We use two functional programming languages in COS 326 course: OCaml and F#.
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.