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.
やあみんな私は立ち往生していて、どうすればよいかわからない:
タプル (2,4) では、すべての操作を実行し、結果を出力する必要があります。
(2,4,'+',6),(2,4,'*',8)
私の考えはこのようなものでした
操作 x = [(x,Ops,finalValue) | x <- x, Ops <- Ops, finalValue <- finalValue]
しかし、乗算加算などを評価して演算の結果を計算する方法がわかりません...私を軌道に乗せるための提案はありますか?
ありがとう
もちろん、最初の解決策は
operations (x, y) = [ (x, y, '+', x+y), (x, y, '*', x*y) ]
より多くの操作のために、より多くのタプルで拡張するだけです。