[英]“and” and tail recursion
我可以使用递归调用in and
语句构建迭代过程吗?
例如,目的,我们有没有做任何事情的函数foo
。 它将创建什么样的过程(迭代或递归)?
(define (foo? bar)
(if (< bar 0) true (and (> 10 1) (foo? (- bar 1)))))
是的, and
是OK -你可以在阅读本标准 。
为了兰伯特,让我们扩展语法。
(define (foo? bar)
(if (< bar 0)
#t ; tail position, but no call
(if (> 10 1)
(foo? (- bar 1)) ; tail position
#f))) ; tail position, but no call
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.