【发布时间】:2009-06-03 00:34:48
【问题描述】:
我正在学习 Scheme。下面的代码有什么问题?我想编写一个程序,从列表中获取第一个函数,然后将其应用于一个数字?
(define num 3)
;;I want to do something like this which returns 3
((λ (x) x)num)
;;but my functions are in a list so this should return3
((first '((λ (x) x) (λ (x) (* x x)))) num)
上述代码出现此错误:
程序应用程序:预期程序,给定:(λ (x) x);论据是:3
当我得到这些类型的输出是什么意思?
当我不应用任何东西时,我会得到一个不错的输出。
(first '((λ(x) x)(λ(x) (*x x))))
返回 (λ (x) x)
【问题讨论】:
标签: scheme