Re:小分けの処理とまとめた処理をまとめたい

http://d.hatena.ne.jp/RiSK/20121027/1351317259

頑張って javascript 語で書くよん。

function string_to_write_proc(str) {
  return function() {
    document.write(str);
  };
};

function proc_binop(lhs, rhs) {
  return function() {
    lhs(); rhs();
  };
};

function string_binop(lhs, rhs) {
  return lhs + rhs;
};

["mizuiro", "sorairo"].map(string_to_write_proc).reduce(proc_binop).call();
string_to_write_proc(["mizuiro", "sorairo"].reduce(string_binop)).call();

要は文字列という半群を構造を保ちつつ処理君にして畳みこむか、文字列を畳み込んで処理君にするかの違いみたいな。

果てしない自明くささのある話だな…うーん。

ていうか本当は reduce とかしたら stack がーってなるので sequence みたいなのが求められるわけですが、まあそういうのはいいでしょう…

疲れた。タイピングは疲れる。あと体が痛すぎて頭が痛くなってきた。