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.
List.ClearJava や C# などの言語におけるシーケンスの Nim の等価性は何ですか? システムに procsetLenがリストされているのを見ますが、それが私が望むことをするかどうかはわかりません。説明から:
List.Clear
setLen
f the current length is greater than the new length, s will be truncated. s
seq len を 0 に設定するたびに、seq の新しいインスタンスが作成されるということですか?
setLenseq新しいものを割り当てずにサイズを変更するため、通常x.setLen(0)は問題ありません。seq新しいものを割り当てて、ガベージ コレクターに古いものをクリーンアップさせたい場合は、x = @[]代わりに行うことができます。
seq
x.setLen(0)
x = @[]