什么是“按姓名致电"? [英] What is "Call By Name"?

查看:63
本文介绍了什么是“按姓名致电"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一项家庭作业,要求我们用我们开发的某种语言(使用Scheme)实施一种称为按名称致电"的评估策略.

I'm working on a homework assignment where we are asked to implement an evaluation strategy called "call by name" in a certain language that we developed (using Scheme).

我们在Scala中得到了一个示例,但我不知道该怎么做按名称呼叫"有效,与按需求呼叫"有何不同?

We were given an example in Scala, but I don't understand how "call by name" works and how it is different to "call by need"?

推荐答案

按需呼叫是按名称呼叫的记忆版本(请参见

Call-by-need is a memoized version of call-by-name (see wikipedia).

在按名称调用中,每次使用该参数时都会对参数进行评估 ,而在按需调用方式中,参数将在首次使用时进行评估,并记录该值随后无需重新评估.

In call-by-name, the argument is evaluated every time it is used, whereas in call-by-need, it is evaluated the first time it is used, and the value recorded so that subsequently it need not be re-evaluated.

这篇关于什么是“按姓名致电"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆