質問編集履歴
2
仮引数を変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,9 +30,9 @@
|
|
30
30
|
|
31
31
|
# selfを根とした木の配列を再帰的に作る
|
32
32
|
|
33
|
-
def subtree(
|
33
|
+
def subtree(prc)
|
34
34
|
|
35
|
-
children.flat_map {|ch| ch.subtree(
|
35
|
+
children.flat_map {|ch| ch.subtree(prc) } + [prc.call(self)]
|
36
36
|
|
37
37
|
end
|
38
38
|
|
1
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ブロックを
|
1
|
+
ブロックを受け取るメソッドを再帰的に呼び出したい
|
test
CHANGED
File without changes
|