![](/img/trans.png)
[英]Haskell: Getting the output of a function to be used as an input to another?
[英]Feeding the output of two functions to another function Haskell
我有三個功能。
function1 :: [Person] -> [String]
function2 :: String -> [Person] -> [(String, Int)]
function3 :: [String] -> [(String, Int)] -> [String]
我希望將function1
和function2
的輸出傳遞給function3
。 例如function3(function1 function2)
但是function1
和function2
都有自己的參數,所以它看起來像:
function3(function1([Person]) function2(String [Person]))
我查看了函數組合,但是當你將一個函數的輸出提供給另一個函數時。 在這種情況下,我想將兩個單獨函數的輸出提供給另一個。
謝謝。
您的函數調用不需要括號。 f (gh)
表示f應用於單個參數gh
。 你可能想要function3 (function1 ...) (function2 ...)
,其中...
是每個函數的參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.