This file contains 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
/* | |
* | |
* Implementation using linked lists | |
* | |
*/ | |
#ifndef ST_TREE_H | |
#define ST_TREE_H | |
#include "error.h" |
This file contains 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
-- Parsing CVS, from RealWorldHaskell | |
csvFile = endBy line eol --Define a csvFile as a line that is terminated by an EOL character | |
line = sepBy cell (char ',') --Define a line as a group of cells separated by commas | |
cell = many (noneOf ",\n") --Define a cell as many characters that do not contain a comma and newline | |
eol = char '\n' --Define EOL character as a '\n' character | |
-- Regex equivalent | |
(?:^|,)(?=[^"]|(")?)"?((?(1)[^"]*|[^,"]*))"?(?=,|$) |
This file contains 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
-- This makes sense | |
Prelude> max 1 2 | |
2 | |
-- So does this | |
Prelude> max [1] [2] | |
[2] | |
-- Not really sure about this. | |
Prelude> max [1,2] [1] |
This file contains 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
cabal() { | |
if [[ $1 == "exec" ]] | |
then | |
shift | |
local dir=$PWD conf db | |
while :; do | |
conf=$dir/cabal.sandbox.config | |
[[ ! -f $conf ]] || break | |
if [[ -z $dir ]]; then | |
echo "Cannot find cabal.sandbox.config" >&2 |