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 MemoFib ( | |
memoFib | |
) where | |
import qualified Data.Map as M | |
memoFib :: (Ord k, Num k, Num a) => k -> a | |
memoFib k = snd $ memoFib' (M.fromList [(0,0),(1,1)]) k | |
memoFib' :: (Ord k, Num k, Num a) => M.Map k a -> k -> (M.Map k a, 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
import Parupunte | |
import Prelude hiding ((+), (*)) | |
import qualified Prelude as P | |
main = do | |
print $ (2+8)*(3+7) -- should print 37 | |
print $ (2 P.+ 8) P.* (3 P.+ 7) |
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
#! /bin/bash | |
if [ $# -ne 1 ]; then | |
echo 'Usage: texpdf file(w/o extension)' | |
exit 1 | |
fi | |
platex $1.tex && platex $1.tex && dvipdfm -p a4 $1.dvi | |
if [ -e $1.dvi ]; then | |
rm $1.dvi |
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
upperCase :: Char -> Char | |
upperCase c = | |
let l = length ['a'..'z'] | |
t = length $ takeWhile (/=c) ['a'..'z'] | |
in | |
if l == t | |
then c | |
else ['A'..'Z'] !! t | |
upperString :: String -> String |
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
a = 0, | |
b = 1, | |
for (i = 0; i < 31 - 2; i = i + 1) | |
tmp = a, | |
a = b, | |
b = tmp + b., | |
puts(b). |
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
makeFib = func() | |
inner a = 0, | |
inner b = 1, | |
func() | |
rtn = a, | |
a = b, | |
b = rtn + b, | |
rtn.., | |
fib = makeFib(), | |
for (i = 0; i < 50; i = i + 1) |
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
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
private: |
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
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
public: |
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
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
public: |
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
[color] | |
ui = true | |
[alias] | |
log-graph = log --graph --decorate --abbrev-commit --all | |
[core] | |
editor = emacs | |
#editor = nano | |
[credential] | |
helper = cache | |
[gui] |