当前位置: X-MOL 学术arXiv.cs.OH › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
How to Design While Loops
arXiv - CS - Other Computer Science Pub Date : 2020-08-21 , DOI: arxiv-2008.12375
Marco T. Moraz\'an (Seton Hall University)

Beginning students find the syntactic construct known as a while loop difficult to master. The difficulties revolve around guaranteeing loop termination and around learning how to properly sequence mutations to solve a problem. In fact, both of these are intertwined and students need to be taught a model that helps them reason about how to design while loops. For students that have been introduced to how to design programs using structural recursion, generative recursion, accumulative recursion, and mutation, the task of teaching them how to design while loops is made easier. These students are familiar, for example, with state variables, termination arguments, and accumulator invariants. All of these are fundamental in the design of while loops. This articles presents a novel technique used at Seton Hall University to introduce beginners to the design of while loops. It presents a design recipe that students can follow step-by-step to establish such things as the driver of the loop, the loop invariant, and the proper sequencing of mutations. The article also presents an example of designing a while-loop based function using the new design recipe.

中文翻译:

如何设计 While 循环

初学者发现被称为 while 循环的句法结构很难掌握。困难围绕着保证循环终止和学习如何正确排序突变以解决问题。事实上,这两者是相互交织的,需要教授学生一个模型来帮助他们推理如何设计 while 循环。对于已经了解如何使用结构递归、生成递归、累积递归和变异设计程序的学生,教他们如何设计 while 循环的任务变得更容易了。例如,这些学生熟悉状态变量、终止参数和累加器不变量。所有这些都是 while 循环设计的基础。本文介绍了 Seton Hall 大学使用的一种新技术,向初学者介绍了 while 循环的设计。它提供了一个设计秘诀,学生可以逐步遵循该秘诀来建立诸如循环驱动程序、循环不变量和正确的突变排序等内容。本文还提供了一个使用新设计配方设计基于 while 循环的函数的示例。
更新日期:2020-08-31
down
wechat
bug