リファクタリング by りおん#11
Open
leon-joel wants to merge 9 commits into
Open
Conversation
* Array.transpose を使う * array という変数名は Array(クラス名)と紛らわしいので変更 * より意味が伝わりやすいよう、split(¥n) から each_line に変更
* input/output行列の形・内容がひと目で分かるようヒアドキュメントを使う
* メソッドチェーン化
This reverts commit 6eef2f1.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Array#transposeを使うArrayクラスには行列を転置するメソッド
transposeが既に用意されています。メソッドチェーン化する
一時変数を撤廃することができ、かつやりたいことがより明確に記述できます。
[テストコード] ヒアドキュメントを使って行列を表現する
ヒアドキュメントを使えば、より明確に行列を表現できます。
※ただし、テストコードが長くなるので、テストコード量によっては\nを使って1行で表現したほうがいい場合もあるかと。