Scheme 如何在方案2中合成n个阶乘

Scheme 如何在方案2中合成n个阶乘,scheme,Scheme,应用合成公式(定义(合成gf)(λ(x)(g(fx)))以构造2^n!n!函数的非尾部和尾部递归实现!和2^n 为了n!我想是n2 (define (factorial n) (fold * 1 (iota n 1))) (define (two-to-the n) (fold * 1 (make-list n 2))) 我如何为2^n!构建它!? 也许吧 composeRacket不是特定的吗?@sylvest OP谈到了使用compose,所以很明显他们准备自己定义它。@user4

应用合成公式
(定义(合成gf)(λ(x)(g(fx)))
以构造2^n!n!函数的非尾部和尾部递归实现!和2^n

为了n!我想是n2

(define (factorial n)
  (fold * 1 (iota n 1)))
(define (two-to-the n)
  (fold * 1 (make-list n 2)))
我如何为2^n!构建它!? 也许吧


compose
Racket不是特定的吗?@sylvest OP谈到了使用
compose
,所以很明显他们准备自己定义它。@user432495没有。但是你的帖子已经谈到了定义你自己的,
(定义(组成fg)(lambda(x)(f(gx)))
*耸耸肩*OP怎么可能没有意识到他有(定义(撰写…在他自己的帖子中?@Rptx这可能是一个家庭作业问题的剪贴。
factorial
的定义和
的两个定义实际上是我在OP中为a写的(滑稽的)答案。(你需要10万名代表才能看到删除的帖子。)
(define (two-to-the factorial n )
  (fold * 1 (iota n 1)))(fold * 1 (make-list n 2)))
(define two-to-the-factorial (compose two-to-the factorial))