开发者

How can I print definition of a symbol without evaluation in Scheme?

开发者 https://www.devze.com 2023-03-12 18:01 出处:网络
If I want to print function de开发者_StackOverflowfinition for a symbol, what should I do?If I understand correctly, you want a function print-function such that after

If I want to print function de开发者_StackOverflowfinition for a symbol, what should I do?


If I understand correctly, you want a function print-function such that after

(define (foo x) (cons x x))

it will behave as

> (print-function foo)
(lambda (x) (cons x x))

Standard Scheme doesn't have a facility for that. The reason is Scheme implementations may, and generally do, compile functions into a different representation (bytecode, machine code).

Some Schemes may keep the function definition around; check your implementation's manual.

0

精彩评论

暂无评论...
验证码 换一张
取 消