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
#include <memory> | |
#include <iostream> | |
template <typename T> | |
struct _list; | |
template <typename T> | |
using list = std::shared_ptr<_list<T>>; | |
template <typename T> | |
struct _list { |
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
fib :: Int -> Integer | |
fib = head . makefib where | |
makefib 0 = [0] | |
makefib 1 = [1,0] | |
makefib n = (head nextfib + head (tail nextfib)):nextfib where nextfib = makefib $ n - 1 | |
main :: IO () | |
main = print $ fib 1000 |
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
{- | |
Handwritten packrat parser for trivial integer arithmetic expressions. Guarantees O(n) time/space complexity. | |
Rule: Exp <- IntVal / (Exp) / (+ Exp Exp) / (- Exp Exp) / (* Exp Exp) | |
Examples: " 233 ", "( + 42 ((233) ) )", "( (* 42 (+ 1 233)) )". | |
Properly handles whitespaces. "2 33" will not be recognized as 233. | |
-} | |
import Data.Char | |
data Node = Nil | Node {next::Node,char::Char,skipped::Node,result::Result} |
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
import Data.Char | |
newtype Parser a = Parser (String -> [(a,String)]) | |
parse :: Parser a -> String -> ([(a,String)]) | |
parse (Parser p) inp = p inp | |
instance Monad Parser where | |
return val = Parser (\inp -> [(val,inp)]) | |
pa >>= f = Parser (\inp -> |
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
import qualified Data.Map as Map | |
type Env = Map.Map String Term | |
data Term = | |
VarTerm String | |
| IntTerm Int | |
| BoolTerm Bool | |
| LambdaTerm String Term | |
| AppTerm Term Term |
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
import qualified Data.Map as Map | |
type Env = Map.Map String Val | |
data Exp = | |
ConstExp Val | |
| VarExp String | |
| LambdaExp Pat Exp | |
| LetrecExp [(Pat,Exp)] Exp | |
| IfExp Exp Exp Exp |
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
{"0010freeproxy.info": ["DE", "Glype", false], "0013freeproxy.info": ["DE", "Glype", false], "0021freeproxy.info": ["DE", "Glype", false], "007browser.info": ["US", "Glype", false], "123anonymous.com": ["US", "Glype", false], "1774.info": ["US", "Glype", false], "1agent.info": ["US", "Glype", false], "1block.info": ["US", "Glype", false], "1catch.info": ["US", "Glype", false], "1close.info": ["US", "Glype", false], "1closed.info": ["US", "Glype", false], "1force.info": ["US", "Glype", false], "1good.info": ["US", "Glype", false], "1lazy.info": ["US", "Glype", false], "1mesh.info": ["US", "Glype", false], "1proxy.us": ["US", "PHProxy", true], "1total.info": ["US", "Glype", false], "2999.info": ["US", "Glype", false], "2action.info": ["US", "Glype", false], "2closed.info": ["US", "Glype", false], "2fastsurfer.eu": ["US", "Glype", false], "2fix.info": ["US", "Glype", false], "2g23.com": ["US", "Glype", false], "2g34.com": ["US", "Glype", false], "2gram.info": ["US", "Glype", false], "2insta.info": ["US", "Glype" |
This file has been truncated, but you can view the full file.
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
{ | |
"event_title": "International Conference on Functional Programming", | |
"event_contents": [ | |
{ | |
"conference_title": "Commercial Users of Functional Programming", | |
"conference_contents": [ | |
{ | |
"proceeding_title": "CUFP '10:ACM SIGPLAN Commercial Users of Functional Programming", | |
"proceeding_contents": [ | |
{ |
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
import Control.Applicative | |
import Control.Monad.State | |
import Data.Char | |
import Data.Function | |
type Parser = StateT String Maybe | |
parse :: Parser a -> String -> Maybe (a,String) | |
parse = runStateT |
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
{- | |
Different ways to implement Fibonacci function in Haskell. | |
F(0)=0 F(1)=1 F(n)=F(n-1)+F(n-2) | |
-} | |
import Control.Monad.State.Strict | |
import Control.Monad.ST.Strict | |
import Data.STRef.Strict | |
import System.TimeIt |
OlderNewer