问题描述
我有一个问题,我相信通过编程的功能风格最好地解决。
I have a problem, which I believe to be best solved through a functional style of programming.
来自非常必要的背景,我习惯于编程设计涉及类图/描述,通信图,状态图等。然而,这些图都表示或用于描述系统的状态以及操作对系统的各种副作用。
Coming from a very imperative background, I am used to program design involving class diagrams/descriptions, communication diagrams, state diagrams etc. These diagrams however, all imply, or are used to describe, the state of a system and the various side effects that actions have on the system.
在功能程序的设计中是否使用了任何标准化的图表或数学符号,或者是在短功能伪代码中最佳设计的程序(由于功能比命令式对应程序短得多)
Are there any standardised set of diagrams or mathematical symbols used in the design of functional programs, or are such programs best designed in short functional-pseudo code (given that functions will be much shorter than imperative counterparts).
谢谢,Mike
推荐答案
-
它的大部分是无状态的,所以传统的命令式图并不重要。
It's largely stateless, so the traditional imperative diagrams don't matter.
大多数普通的花园多样的数学符号是也是无状态的。
Most of ordinary, garden-variety math notation is also stateless.
功能设计比其他任何东西更像代数。您将要定义函数,并显示这些函数的组合产生所需的结果。
Functional design is more like algebra than anything else. You're going to define functions, and show that the composition of those functions produces the desired result.
图不是必需的,因为功能编程比程序简单节目。它更像传统的数学符号。使用数学技巧来表明你的各种功能做正确的事情。
Diagrams aren't as necessary because functional programming is somewhat simpler than procedural programming. It's more like conventional mathematical notation. Use mathematical techniques to show that your various functions do the right things.
这篇关于功能编程 - 标准符号,图表等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!