Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これは私が時々やりたいと思っていることです。引数のリストがあるとします。Lispでは、次のように行くことができます
`(imaginary-function ,@args)
配列を1つの要素から正しい数の引数に変えて関数を呼び出すため。
Ruby に同様の機能はありますか? それとも、ここで完全に間違ったイディオムを使用しているだけですか?
はい!これはスプラット演算子と呼ばれます。
a = [1, 44] p(*a)
これはスプラット演算子です:function(*list)
function(*list)