检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
机构地区:[1]解放军理工大学指挥信息系统学院研究生2队,江苏南京210007 [2]解放军理工大学指挥信息系统学院
出 处:《军事通信技术》2013年第1期43-48,95,共7页Journal of Military Communications Technology
摘 要:"泛型编程"旨在编写一般化并可重复使用的算法,主要目的是提高程序的复用性,其效率与针对某特定数据类型而设计的算法相同。在书写泛型函数时经常会出现新的数据结构或类型,这些数据类型往往并不符合已有通用函数的计算方式,而要计算这些新的数据类型需要修改原有通用函数的定义,从而极大降低了程序的复用性。通过定义新函数来操作新的数据类型可以避免频繁修改原有通用函数。但是,新函数定义中必然会有大量与原有通用函数功能相似的重复冗余代码,因此,引入"缺省情况"使得新函数的定义可以通过调用原有通用函数而获得,这样即不对原有函数造成影响,又极大简化了针对新类型书写相关函数的复杂程度。文中利用Camlp5工具对O′Caml语法进行扩展,在原有"泛型编程"的基础上引入了"缺省情况",使该语言书写的泛型函数更加清晰、不易出错,从而极大提高了O′Caml中"泛型编程"的稳定性和复用性。The main idea of generic programming is to design a generic algorithm that can be reused. The purpose is to improve reuse of shuttering. The efficiency of the generic function is equal to the function designed for some special data type. Generic programming can completely separate the algorithm and the data type, and make the function more flexible. While one is interested in generic behavior for the large part of the datatypes involved, some particular types should be treated in a special way. Some datatypes hold variables. When defining the function for these datatypes, one need the function definition about the type variables. An already existing type indexed function can be extended, by default case, and the new clause has no influence on the existing type-indexed function. This makes the definition on the new type simple. It shows the extension of the grammar of O' Carol according to some rules, which also introduces the idea of default case.
分 类 号:TP312[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.7