プログラマーになりたい。

プログラミングや写真や本や読書会のことや、日常のこと。

@2bbbにトキメキ, ノイズ, アイドル, ポカリを使った総ての組み合わせを返す…

@2bbbに

トキメキ, ノイズ, アイドル, ポカリを使った総ての組み合わせを返すHaskellプログラムを書きなさい

とかいわれても頑張る気力がないので、さっさとごめんなさいして、残念なコードを書きました。

noiseidol = [(w1,w2,w3,w4) |
w1 <- ["tokimeki","noise","idol","pocurry"],
w2 <- ["tokimeki","noise","idol","pocurry"], w2 /= w1,
w3 <- ["tokimeki","noise","idol","pocurry"], w3 /= w1, w3 /= w2,
w4 <- ["tokimeki","noise","idol","pocurry"], w4 /= w1, w4 /= w2, w4 /= w3 ]

(改行とってね。)
これはひどい><…。


結果:

$cyi
Prelude> :l noiseidol.curry
noiseidol> noiseidol
[("tokimeki","noise","idol","pocurry"),("tokimeki","noise","pocurry","idol"),
("tokimeki","idol","noise","pocurry"),("tokimeki","idol","pocurry","noise"),
("tokimeki","pocurry","noise","idol"),("tokimeki","pocurry","idol","noise"),
("noise","tokimeki","idol","pocurry"),("noise","tokimeki","pocurry","idol"),
("noise","idol","tokimeki","pocurry"),("noise","idol","pocurry","tokimeki"),
("noise","pocurry","tokimeki","idol"),("noise","pocurry","idol","tokimeki"),
("idol","tokimeki","noise","pocurry"),("idol","tokimeki","pocurry","noise"),
("idol","noise","tokimeki","pocurry"),("idol","noise","pocurry","tokimeki"),
("idol","pocurry","tokimeki","noise"),("idol","pocurry","noise","tokimeki"),
("pocurry","tokimeki","noise","idol"),("pocurry","tokimeki","idol","noise"),
("pocurry","noise","tokimeki","idol"),("pocurry","noise","idol","tokimeki"),
("pocurry","idol","tokimeki","noise"),("pocurry","idol","noise","tokimeki")]

数かぞえたりもしてないんけど、間違ってたらいっておくれ。
おれはもう駄目だ。

Creative Commons License ©2007-2021 IIDA Munenori.