小编Cas*_*erg的帖子

为什么非常大的斐波那契数会产生椭圆形?

in_range = int(input("range: "))

fibo_list = []

a = 0
b = 1
count = 0

if in_range < 0:
    print("faulty")
elif in_range == 0:
    print("faulty")
else:
    while count < in_range:
        c = a + b
        a = b
        b = c
        count += 1
        fibo_list.append(a)


print(fibo_list)
Run Code Online (Sandbox Code Playgroud)

这段代码的范围输入1000时,会产生很多椭圆形状,有些是很难看出来的。这似乎只发生在斐波那契数列中,而没有其他长数链。为什么是这样?这是椭圆的样子

python largenumber fibonacci

7
推荐指数
1
解决办法
231
查看次数

我的宏在 Common Lisp 中部分应用的问题

我正在尝试制作一个宏来实现在 Common Lisp 中的部分应用。这是我如何在伪代码中实现它的想法:

If my argument list is null, return the function body
Otherwise, cons together "lambda" with the first argument with a recursive call to "partial-lambda" again

(lambda (x y z) (+ x y z) => (lambda (x) (lambda (y) (lambda (z) (+ x y z))))
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

If my argument list is null, return the function body
Otherwise, cons together "lambda" with the first argument with a recursive call to "partial-lambda" again

(lambda (x y z) (+ x …
Run Code Online (Sandbox Code Playgroud)

macros common-lisp currying

2
推荐指数
1
解决办法
90
查看次数

标签 统计

common-lisp ×1

currying ×1

fibonacci ×1

largenumber ×1

macros ×1

python ×1