首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到17条相似文献,搜索用时 93 毫秒
1.
Haskell语言的高阶特性及其应用   总被引:6,自引:2,他引:4  
Haskell语言的高阶特性使笔者在开发软件时受益匪浅,但很遗憾,目前国内同行应用这一语言的人非常少。本文介绍Haskell语言的高阶特性,并通过几个与树相关的例子,阐述如何利用Haskell语言的高阶特性来编写功能强大但却简短漂亮的程序。  相似文献   

2.
Haskell语言的惰性计算特性及其应用   总被引:2,自引:0,他引:2  
Haskell的惰性计算特性使笔者在开发软件时解决了其它语言很难解决的一些问题,但如何在实际编程中充分利用这一特性,讨论的文章较少。该文详细介绍Haskell的惰性计算特性,并通过几个相关的简单例子,阐述如何利用惰性计算特性来编写简洁优美且功能强大的程序。  相似文献   

3.
泛型即通过参数化类型来实现在同一份代码上操作多种数据类型.泛型编程是一种编程范式,它利用“参数化类型”将类型抽象化,实现灵活的软件复用.泛型编程思想已经在多种语言中得到运用,并已取得了不小的成果.文中旨在Haskell语言上进行泛型的研究与应用,Haskell语言是一门广为流行的函数式语言,它的计算模型简单,程序语法清晰,易于编写,易于维护.文中利用一些规则对Haskell语言的语法进行扩展,同时引入泛型编程的思想来研究新的函数定义方法,最后在Haskell语言上实现泛型功能.  相似文献   

4.
对于泛型程序设计来说,类型的参数化多态是其理论框架,参数化多态引入了类型变量,使得类型参数化,支持类型上的抽象,从而可以大大提高软件的复用程度。泛型编程思想已经在多种语言中得到运用,并已取得了不小的成果。在函数式语言上进行泛型的研究与应用,Haskell语言是函数式语言中较为经典的一种语言,它的计算模型简单,语法清晰,易于编写,易于维护,拥有很大的发展空间。利用一些规则对Haskell语言的语法进行相关扩展,同时引入泛型的思想,研究与运用定义泛型函数的方法,在Haskell语言上实现了泛型功能。  相似文献   

5.
苏锦钿  余珊珊 《计算机科学》2011,38(7):144-147,156
函数式程序语言Haskell中的Monads理论在描述上下文依赖计算等方面存在一定的不足。作为Monads的范畴论对偶概念,Comonads理论可以有效地提高Haskell对上下文依赖计算的描述能力。首先给出Comonads的范畴论定义和性质,以及Comonads在Haskell的具体实现;接着探讨Comonads的CoKleisfi三元组和CoKleisli范畴,通过实例说明如何将其应用于上下文依赖计算的描述和推理中;最后进一步研究Comonads与Monads之间的分配律,指出如何通过分配律将效果计算与上下文依赖计算有机地融合起来。  相似文献   

6.
F#前瞻     
陈子醉 《程序员》2008,(7):94-95
F#是一门新的函数式编程语言。它来自于OCaml,集LinQ,Haskell之长,基于.Net Framework构建,可以实现很多其他函数语言无法实现的功能,本文使我们对它有了一个初步的了解。  相似文献   

7.
F#前瞻     
陈子醉 《Internet》2008,(7):94-95
F#是一门新的函数式编程语言。它来自于OCaml,集LinQ,Haskell之长,基于.Net Framework构建,可以实现很多其他函数语言无法实现的功能,本文使我们对它有了一个初步的了解。  相似文献   

8.
为了从另一个角度提高决策树算法的效率,对标准的ID3决策树算法进行函数式语言Haskell描述,研究了程序演化策略,推衍出了一个高效等价算法。实验结果证明演化过程是正确的。  相似文献   

9.
提出通过测试来证明安全协议的方法。以NS和NSL协议为例,首先将协议形式化为事件序列,协议的性质可以表示为序列上的性质。协议的完整运行可以系统地生成,因此,协议的性质可以系统地测试。形式化和测试在函数程序设计语言Haskell中完成。  相似文献   

10.
韩祝鹏 《程序员》2010,(8):83-85
程序的江湖中总是风水轮流转,前些年面向对象编程(OOP)当道,这几年函数式编程(FP)渐渐渗透进主流。莫要感叹世事变化莫测,让我们抛开纷杂的表象,追本溯源,来一次寻根之旅,领略下最纯粹的FP语言Haskell的美妙。  相似文献   

11.
The Eindhoven approach to quantifier notation is 40 years old. We extend it by adding “distribution comprehensions” systematically to its repertoire; we believe the resulting notation for elementary probability theory is new.After a step-by-step explanation of the proposed notational innovations, with small examples, we give as our exemplary case study the probabilistic reasoning associated with a quantitative noninterference semantics based on Hidden Markov Models of computation. Although that example was the motivation for this work, we believe the proposal here will be more generally applicable: and so we also revisit a number of popular puzzles, to illustrate the notation's wider utility.Finally, we review the connection between comprehension notations and (category-theoretic) monads, and show how the Haskell approach to monad comprehensions applies to the distribution comprehensions we have introduced.  相似文献   

12.
13.
Haskell has a sophisticated mechanism for overloading identifiers with multiple definitions at distinct types. Object-oriented programming has a similar notion of overriding and overloading for methods names. Unfortunately, it is not possible to encode object-oriented overloading directly using Haskell overloading. This deficiency becomes particularly tiresome when Haskell programs wish to call methods imported from an object-oriented library.We present two refinements of Haskell's type class system: Closed classes and overlapping instances. We demonstrate how we may exploit the refined system so as to be able to encode object-oriented classes within Haskell. This encoding allows us to mimic, within Haskell, the overloading resolution rules employed by object-oriented languages without the need for additional type annotations or name mangling. As a consequence, object-oriented class libraries are very convenient to import and use within Haskell.We thank Don Syme, Nick Benton, Andrew Kennedy, and the anonymous reviewers, for many helpful comments.  相似文献   

14.
Edison is a library of functional data structures implemented in Haskell. It supports three main families of abstractions: sequences, collections (e.g., sets and priority queues), and associative collections (e.g., finite maps). This paper summarizes the design of Edison, with particular attention to how that design is influenced by details of Haskell.  相似文献   

15.
We demonstrate how to build certain cyclic and other multi-linked structures in the lazy functional programming language Haskell. No explicit pointers are used in these constructions. Each task is accomplished by starting with a suitable specification and then calculating the required program.  相似文献   

16.
Hood allows debugging Haskell programs by introducing observation marks. In this paper, we show how to use pHood (a parallel version of Hood) to analyze properties of programs written using parallel dialects of Haskell. In particular, we have tested the tool with programs written in the languages GpH and Eden (although it also works with other parallel dialects), and we have implemented methods to perform analyses of unneeded work as well as an analysis of duplicated work. By doing so, we show the usefulness and versatility of the tool.  相似文献   

17.
Eden is a parallel extension of the functional language Haskell. On behalf of parallelism Eden overrides Haskell's pure lazy approach, combining a non-strict functional application with eager process creation and eager communication. We desire to investigate alternative semantics for Eden in order to analyze the consequences of some of the decisions adopted during the language design. In this paper we show how to implement in Maude the operational semantics of Eden in such a way that semantic rules can be modified easily. Moreover, other semantic features can be implemented by means of parameterized modules that allow to instantiate in different ways several parameters of the semantics but without modifying the semantic rules.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号