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
#!/usr/bin/env ruby | |
# -*- mode: ruby; coding: utf-8-unix -*- | |
def rsample(n,m) | |
l = n+m-1 | |
bins = Array.new(l,0) | |
(0..(m-2)).each{|k| bins[k]=1} | |
(0..(l-2)).each do |k| | |
j = rand(l-k) + k |
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
module Main where | |
import Numeric (showFFloat) | |
import qualified Numeric.SpecFunctions as N | |
import Numeric.Tools.Integration | |
import Graphics.Rendering.Chart.Easy | |
import Graphics.Rendering.Chart.Backend.Cairo | |
dbeta :: Double -> Double -> Double -> Double |
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
# -*- mode: ruby; coding: utf-8-unix -*- | |
IRB::Color.instance_eval do | |
exprs = const_get('TOKEN_SEQ_EXPRS') | |
t_all = const_get('ALL') | |
exprs[:on_const] = [[self::YELLOW, self::BOLD, self::UNDERLINE], t_all] | |
exprs[:on_int] = [[self::YELLOW, self::BOLD], t_all] | |
end |
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
CFLAGS = -O3 | |
.PHONY: all clean | |
all: horizontal vertical | |
horizontal: cache_test.c | |
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
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
class Hoge | |
def a=(x) | |
puts "Pooh!" | |
end | |
private "a=".intern | |
def a | |
puts "Bra!" | |
end | |
private :a |
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
def show_iv(iv) | |
"(%s)"%(iv.collect{|x|x.to_s}.join(",")) | |
end | |
def sub_iv(iv0, iv1) | |
iv0.zip(iv1).collect{|x0,x1| x0 - x1} | |
end | |
def add_dependence(iv, ds, us, du_lst) | |
us.each do |u| |
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
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Vec3DList where | |
import GHC.Generics (Generic) | |
import Foreign.Ptr (Ptr, nullPtr) |
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 <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
typedef union U_DBL_INT { | |
double d; | |
uint64_t i; | |
} dbl_int_t; |
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
comb_0_1 :: (Num a) => Int -> [[a]] | |
comb_0_1 n | n >= 0 = f [[]] n | |
| otherwise = [] | |
where f xs 0 = xs | |
f xs n = f [(b:x) | b<-[0,1], x<-xs] (n-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
module Main where | |
a :: Integer | |
a = a + 1 | |
main :: IO () | |
main = putStrLn (show a) |
NewerOlder