我正在尝试编写一些函数来确定实根的数量和二次方程的根,我必须使用library(whisker)
template <-
'I am {{name}} \n
My children are: \n
{{#children_names}}
Child No {{number}} is {{cname}}
{{/children_names}}'
data <- list(
name = "Chris",
children_names = list(
list(cname = "Alex", number = 1), list(cname = "John", number = 2)
)
)
text <- whisker.render(template, data)
cat(text)
# I am Chris
#
# My children are:
#
# Child No 1 is Alex
# Child No 2 is John
函数来完成。我想避免的是使用最终函数将所有其他函数作为其参数,如
main()
相反,我怎样才能看起来像:
def main():
function4(function3(function2(function1())), function2(function1()))
答案 0 :(得分:1)
这应该是等效的。
def main():
result1 = function1()
result2 = function2(result1)
result3 = function3(result2)
final_result = function4(result3, result2)