ある程度大きな規模の実際に動くサンプルを呈示する
- 現実のプロジェクトの即した複雑性
- 外部コンポーネントを含む (swing, XMPP)
- イベントドリブン、マルチスレッド、分散環境
- 現実味のあるストーリー
- 「下した決定が間違っていたことが後になって判明したせいで引き返さねばならなくなった」
- 往々にして発生するが、放置しておくと、後になって高い代償を払うことになる
| -module(ordseq). | |
| -export([ | |
| new/0, | |
| is_ordseq/1, | |
| is_empty/1, | |
| len/1, | |
| in/2, | |
| out/1, out_r/1, | |
| peek/1, peek_r/1, |
| %% http://erlang.org/pipermail/erlang-questions/2006-January/018812.html | |
| -module(abst_to_src). | |
| -export([transform/2]). | |
| transform(BeamFName, ErlFName) -> | |
| case beam_lib:chunks(BeamFName, [abstract_code]) of | |
| {ok, {_, [{abstract_code, {raw_abstract_v1,Forms}}]}} -> | |
| Src = | |
| erl_prettypr:format(erl_syntax:form_list(tl(Forms))), | |
| {ok, Fd} = file:open(ErlFName, [write]), |
| http://mochiweb.googlecode.com/svn/trunk/src/reloader.erl | |
| $ erl | |
| 1> reloader:start_link(). |
| ;; paper: http://www.isi.edu/natural-language/people/ravichan/papers/clustering.pdf | |
| (defun cos-sim (u v &key product length) | |
| (/ (funcall product u v) | |
| (* (funcall length u) (funcall length v)))) | |
| (defun h.r (r u) | |
| (if (>= (funcall r u) 0) | |
| 1 | |
| 0)) |
| -module(card). | |
| -export([num/1]). | |
| -export_type([card/0]). | |
| -type card() :: {num, 1..10} | jack | queen | king. | |
| -spec num(card()) -> 1..13. | |
| num({num, N}) -> N; |
| -module(exception_test). | |
| -export([hoge/1, fuga/1]). | |
| %% @doc erlang:error/1を使って例外送出 | |
| hoge(_Arg) -> | |
| error(badarg). | |
| %% @doc erlang:error/2を使って例外送出 | |
| fuga(Arg) -> |