我可以调用下面的代码"Tail Recursive"吗? -Haskell 函数

Can I call the following code "Tail Recursive"? -Haskell function

我应该只实现尾递归函数。这段代码是尾递归的吗,考虑到在每次调用时我都有三个函数在其中工作以获取答案?

anyfunction :: (Ord a) => Int -> [a] -> [a] -> [a] -> a
anyfunction n [] ys ws = anyfunction n ws ys ws
anyfunction (-1) (x:xs) ys ws = something x xs
anyfunction n (x:xs) ys ws = anyfunction (n+1) (someotherthing(something x xs) (x:xs) []) (ys ++ [(something x xs)]) ws

请考虑:'something'和'someotherthing'都是尾递归函数。我很确定。

根据定义,

anyfunction 是尾递归的,无论 someotherthingsomething 是什么。

唯一取决于 someotherthingsomething 是否为尾递归的是 anyfunction 将从尾调用优化中获益多少。