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(rmessage). | |
%-compile(export_all). | |
-export([start/1, stop/0, chain/2, loop/1, init/1]). | |
%% for interface | |
start(Count) -> | |
io:format("start, count[~p].~n", [Count]), | |
[FirstPid | _] = make_pids(Count), | |
register(?MODULE, spawn(?MODULE, loop, [FirstPid])). |
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(reco_cons). | |
-compile(export_all). | |
read() -> | |
{ok, D} = file:consult("reco.cons"), | |
D. | |
get_persons(Data) -> | |
{critics, D1} = lists:keyfind(critics, 1, Data), | |
[K || {K, _} <- D1]. |
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(fizz_buzz2). | |
-compile(export_all). | |
show(Num) -> | |
io:format("~p", [fizz_buzz(Num)]). | |
get_fizz(Num) when Num rem 3 == 0 -> | |
"Fizz"; | |
get_fizz(_Num) -> | |
[]. |
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/perl | |
use 5.10.0; | |
use utf8; | |
use strict; | |
use warnings; | |
use open qw( :utf8 :std ); | |
use Data::Dumper; | |
use DBI; | |
use Parallel::ForkManager; |
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/perl | |
use utf8; | |
use strict; | |
use warnings; | |
use open qw( :utf8 :std ); | |
use Data::Dumper; | |
$Data::Dumper::Terse = 1; | |
$Data::Dumper::Sortkeys = 1; | |
$Data::Dumper::Indent = 0; |
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
"""文章の可読性尺度を求めるには、英語の場合、一般にFlesch-Kincaild式が使われます。この方法で、文章の難易度を表す数値が算出できます。数値は大きいほど文章が読みやすく、易しいことを意味します。この数値は次の式で計算します。 | |
206.835 - 1.015 (全単語数 / すべての文の数) - 84.6 (全音節数 / 全単語数) | |
""" | |
100 Things Every Designer Needs to Know About People, #014 読むことと理解することは同じではない |
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/perl | |
use 5.10.0; | |
use utf8; | |
use strict; | |
use warnings; | |
use open qw( :std :utf8 ); | |
use autodie qw( open close ); | |
use Data::Dumper; | |
use Encode ( ); |
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(http_perf). | |
-export([start/0, stop/0, loop/0]). | |
-export([load/3, get/2]). | |
%-compile([export_all]). | |
-define(WAIT_MS, 3000). | |
start() -> | |
register(?MODULE, spawn(?MODULE, loop, [])). | |
stop() -> |
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
library(digest) | |
# R's index starts with 1, not 0 | |
getdata <- function(index) { | |
q <- floor(index / 10) | |
r <- index %% 10 | |
digest.raw <- digest(as.character(q), algo="sha1", serialize=FALSE, raw=TRUE) | |
data <- sum(as.numeric(digest.raw)[c(2 * r + 1, 2 * r + 1 + 1)] * c(256, 1)) | |
return(data) | |
} |
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
以下は標本抽出の問題を中心にした頭の体操だ。あるパーティで、終身在職権のない酔っ払った統計学者(ぼくも何人も知ってる)が飲み物を混ぜている。彼は学部長のスコッチ&ソーダを作っているのだ。学部長はスコッチとソーダをある厳密な比率で混ぜたものを要求している(具体的には書かない。ぼくらのヒーローがそこまで行けるわけないからね)。 | |
統計学者は、同じ大きさのグラスを2つ使って作業を始める。1つのグラス(最初のグラス)には、2オンスのスコッチを入れ、もう1つ(2番目のグラス)には、2オンスの水を入れる。スコッチの入っているグラスに、1オンスの水を注ぎ始める。ところがすでに失敗していたようだ。混ぜたばかりの飲み物(スコッチと水を混ぜたもの3オンスが入っている)1オンスを、水の入っていたグラスに戻してしまったからだ。ここで、2つのグラスには共に2オンスの液体が入っているが、どちらのグラスの液体も、水とスコッチのよくわからない混合物だ。 | |
神経質な様子でやり直そうとする統計学者を学部長が止める。彼女はこう言う。 | |
提案しましょう。いまそれぞれのグラスに入っているスコッチと水の正確な比率はわかりませんね。スコッチと水をどれくらい混ぜたか判らないから。でも、質問に答えられたら、あなたの終身在職権委員会に強力な支持の手紙を書いてあげましょう。解けなかったら、そうね、あなたほどの能力があれば、ホテル業界や外食産業で難なく職を見つけられるはず。さあ問題。今の時点で、最初のグラスに増えた水と、第二のグラスに増えたスコッチ、どちらが多いでしょう。 | |
この問題を標本抽出の問題として考えよう。最初の標本、つまり、最初のグラスにある液体に入った水と、2番目の標本、つまり、2番目のグラスにある液体に入ったスコッチは、どちらが多いだろうか。スコッチも水も本当に小さな粒子でできているので、それぞれの液体が、それぞれの標本にどれくらい含まれているかを描写するのは難しい。水分子(または標本抽出のスコアで「水」であるもの)が「スコッチ」のスコア群にどれだけ混じっているかは、比率として知ることすら確実にはできない。なぜなら最初のグラスに流れ込んで底に沈んだ水のうち、どの程度が液体の上の方に残ったか、また水のグラスに戻したか、全く判らないからだ。直感的な答えが聞こえるねぇ。残念ながら、そいつは間違いだ。 | |
頭の良い人が直感的に出す答えの典型に、最初のグラス |
OlderNewer