私は任意の数のリストを取り、要素の組み合わせのリストを返すが、各リストから1つの要素のみを結合したい。私が持っているのはどこから始めるべきかわからないので、sudoのコードだけです。いくつかのリストの要素を組み合わせる
私はCombining the elements of 2 listsの質問でこのプログラムの解決策を見つけましたが、私はそのスカラコードを理解していません。私はTclに自分のプログラムを書いていますが、もしあなたが私のJavaやPython、擬似コードなど何でも自由に答えを書いてくれるのを助けてくれれば助かります。誰でも私に人生に次の擬似コードを持たせることができますか?例えば
:ここ
# example: {a b} {c} {d e}
# returns: {a c d} {a c e} {b c d} {b c e}
# how?
# example: {a b} {c} {d e}
# iters: 0 0 0
# 0 0 1
# 1 0 0
# 1 0 1
#
#
# set done false
#
# while {!done} {
#
# list append combination_of_list due to iteration counts
#
# foreach list $lists {
# increment the correct count (specifically {0->1} {0->0} {0->1}) }
# reset the approapraite counts to 0
# }
#
# if all the counts in all the lists are at or above their max {
# set done true
# }
# }
Donal Fellowsはアメリカ人の英雄です。 –
ドナル・フェローズは、強烈な目を持つアルゴリズムの男です。 –