首页> 中文期刊> 《计算机技术与发展》 >O'Caml泛型编程中“泛型抽象”的研究

O'Caml泛型编程中“泛型抽象”的研究

         

摘要

The main idea of generic programming is to design an algorithm that is genetic and can be reused.The purpose is to reuse of shuttering.The efficiency of the generic function is equal to the function which is designed for some special data type.Genetic programming can completely separate the algorithm and the data type,and make the function more flexible.O'Caml has been achieved type-indexed function and genetic programming.Nevertheless,the type argument must be one concrete type.Genetic abstraction allows people to abstract from the type argument in the definition of functions.It shows the extension of the grammar of O'Caml based on some roles,which also introduces the idea of generic abstract programming,and gives some methods to define generic abstract functions.Finally,the function of generic abstraction would be completed in O'Caml.%泛型编程旨在编写一般化并可重复使用的算法,主要目的是提高程序的复用性,其效率与针对某特定数据类型而设计的算法相同.泛型编程可以使算法与数据结构完全分离,极大提高了程序的灵活性.在O'Caml语言中已经实现了类型标记函数和泛型函数,但泛型函数的类型参数只能是基本类型或实例化类型,不能使用抽象类型.“泛型抽象”是指使用抽象类型作为类型参数的函数定义方法,实现了“泛型编程”类型参数的多样化.文中在O'Caml语言上进行“泛型抽象”的研究,根据规则对O'Caml语言语法进行扩展,并在O'Caml语言中实现了“泛型抽象”函数定义.

著录项

相似文献

  • 中文文献
  • 外文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号