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
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE LambdaCase #-} | |
import Control.Monad.Free | |
import qualified Control.Monad.Trans.Free as TF | |
import qualified Data.Foldable as F | |
import qualified Data.List as L | |
import Data.Functor.Foldable | |
import qualified System.Random.MWC.Probability as MWC | |
import qualified Data.IntMap.Strict as IMS |
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
:- %say | |
|= $: * | |
[ben=?(%put %vip %get %bot %del) ~] | |
[min=(list (pair @ @)) mit=(pry @ _~) nit=_| ~] | |
== | |
:- %noun | |
:: +up benchmarks | |
:: | |
=/ pi (up @ _~) | |
:: |
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
worker_send_replace 47276 hole | |
worker_send_replace 47276 crud | |
%hole event failed: | |
bail: exit | |
/:<[18.151 15].[18.169 27]> | |
/:<[18.152 15].[18.169 27]> | |
/:<[18.153 15].[18.169 27]> | |
/:<[18.153 31].[18.153 46]> | |
/:<[18.224 3].[18.237 13]> | |
/:<[18.225 3].[18.237 13]> |
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
-- see: http://matt.might.net/articles/cps-conversion | |
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Monoid | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import Data.Unique | |
import qualified Text.PrettyPrint.Leijen.Text as PP |
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 Data.Vector.Unboxed as U | |
import System.Random.MWC | |
main :: IO () | |
main = withSystemRandom . asGenIO $ \gen -> do | |
x <- uniformVector gen 10000000 :: IO (U.Vector Double) | |
print (U.sum x) | |
-- jtobin@castor:~/sandbox$ time ./Rand +RTS -s | |
-- 4999721.338394913 |
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
{-# OPTIONS_GHC -Wall #-} | |
{-# OPTIONS_GHC -fno-warn-type-defaults #-} | |
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE RecordWildCards #-} | |
import Control.Comonad | |
import Control.Comonad.Cofree |
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
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE RecordWildCards #-} | |
import Control.Comonad | |
import Control.Comonad.Cofree | |
import Control.Monad | |
import Control.Monad.ST |
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
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE LambdaCase #-} | |
import Control.Monad | |
import Control.Monad.Free | |
import qualified System.Random.MWC.Probability as MWC | |
data ModelF r = | |
BernoulliF Double (Bool -> r) | |
| BetaF Double Double (Double -> r) |
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 Metropolis where | |
import Control.Monad | |
import Control.Monad.Primitive | |
import System.Random.MWC as MWC | |
import System.Random.MWC.Distributions as MWC | |
propose :: [Double] -> Gen RealWorld -> IO [Double] | |
propose location gen = traverse (perturb gen) location where |
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
var foo = eth.accounts[0]; | |
personal.unlockAccount(foo, 'mypassword'); | |
miner.setEtherbase(foo); | |
var crowdSrc = "contract token { mapping (address => uint) public coinBalanceOf; event CoinTransfer(address sender, address receiver, uint amount); function token(uint supply) { if (supply == 0) supply = 10000; coinBalanceOf[msg.sender] = supply; } function sendCoin(address receiver, uint amount) returns(bool sufficient) { if (coinBalanceOf[msg.sender] < amount) return false; coinBalanceOf[msg.sender] -= amount; coinBalanceOf[receiver] += amount; CoinTransfer(msg.sender, receiver, amount); return true; } } contract Crowdsale { address public beneficiary; uint public fundingGoal; uint public amountRaised; uint public deadline; uint public price; token public tokenReward; Funder[] public funders; event FundTransfer(address backer, uint amount, bool isContribution); struct Funder { address addr; uint amount; } /* runs on init */ function Crowdsale( address _beneficiary , uint _fundingGoal , uint _duration , uint _pric |
NewerOlder