Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Functional programming 如何在DrScheme中配置文件?_Functional Programming_Scheme_Racket - Fatal编程技术网

Functional programming 如何在DrScheme中配置文件?

Functional programming 如何在DrScheme中配置文件?,functional-programming,scheme,racket,Functional Programming,Scheme,Racket,如何使用DrScheme评测我的函数 (require profile) (define (factorial n) (cond ((= n 1) 1) (else (* n (factorial (- n 1)))))) (profile factorial) 上面的代码返回 Profiling results ----------------- Total cpu time observed: 0ms (out of 0ms) Number of sampl

如何使用DrScheme评测我的函数

(require profile) 
(define (factorial n)
  (cond
    ((= n 1) 1)
    (else (* n (factorial (- n 1))))))

(profile factorial)
上面的代码返回

Profiling results
-----------------
  Total cpu time observed: 0ms (out of 0ms)
  Number of samples taken: 0 (once every 0ms)

====================================
                        Caller
Idx  Total    Self    Name+srcLocal%
     ms(pct)  ms(pct)   Callee
====================================
> 
我试过:-(profile(factorial 100))
-(阶乘)(阶乘100)
但它给了我同样的结果。
我做错了什么?

我不熟悉PLT方案中的
配置文件
模块,但也许您必须实际调用该函数

(profile (factorial 1000))

你有没有试过在(剖面图(阶乘N))中增加N直到出现明显的停顿


(阶乘100)是现代计算机应该能够做的事情,Greg的答案在PLT情况下是正确的--
profile
将在堆栈运行时对其进行采样的同时执行子表达式。请注意,对于小的输入,您的函数将运行得非常快,因此不会持续足够长的时间来获取任何样本——您需要使用大的值。是的,您是正确的。但是为什么(trace factorial)(time(factorial 50))给我cpu时间:484实时:523 gc时间:0,但是(profile(factorial 50))没有效果?