[ create a new paste ] login | about

azumih

Name: Azumi Hayakawa
Email:
Site/Blog: http://azumih.wordpress.com
Location: Japan
Default language: C++
Favorite languages: Python, Haskell
About:

Saved pastes by azumih:

Haskell, pasted on Mar 10:
1
2
3
4
5
#! /usr/bin/env runghc
-- simplistic Monty Hall simulator

import System.Random
import Control.Monad
...
view (41 lines, 2 lines of output)
Haskell, pasted on Mar 7:
1
2
3
4
5
#! /usr/bin/env runghc
-- simplistic Monty Hall simulator

import System.Random
import Control.Monad
...
view (41 lines, 2 lines of output)
Python, pasted on Feb 21:
1
2
3
4
#! /usr/bin/env python
# a naive kind of simulation for Monty Hall problem

import random
...
view (49 lines, 2 lines of output)
C++, pasted on Mar 8:
1
2
3
4
5
// gauss elimination
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cmath>
...
view (79 lines, 1 line of output)
Haskell, pasted on Dec 15:
1
2
3
4
5
-- list monad...
ppp = do
  x <- [1, 2, 3]
  y <- [1, 2, 3]
  True <- return (x /= y)
...
view (8 lines, 1 line of output)
Haskell, pasted on Apr 13:
1
2
3
4
5
-- continuation passing
add'cps :: Int -> Int -> (Int -> r) -> r
add'cps x y k = k $ x + y

square'cps :: Int -> (Int -> r) -> r
...
view (15 lines, 1 line of output)
Haskell, pasted on Apr 13:
1
2
3
4
5
-- Automatic Differentiation

class Val a where val :: a -> Double

data Var = Var Double
...
view (46 lines, 4 lines of output)
Haskell, pasted on Apr 13:
1
2
3
4
5
output x | x3 && x5  = "FizzBuzz"
         | x3        = "Fizz"
         | x5        = "Buzz"
         | otherwise = show x
         where 
...
view (9 lines, 1 line of output)
C++, pasted on Oct 27:
1
2
3
4
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cmath>
...
view (78 lines, 1 line of output)
Haskell, pasted on Oct 5:
1
2
3
4
class Val a where val :: a -> Double

data Var = Var Double
instance Val Var where val (Var v) = v
...
view (44 lines, 4 lines of output)