请输入您要查询的字词:

 

单词 Haskell
释义

Haskell


Haskell is a computer programming language designed by a committee in 1990 to consolidate the best features of the many purely functional programming languagesPlanetmathPlanetmath that were created in the late 1980s. Haskell is thus neither a procedural programming language nor an object-oriented one, although it offers monads such as do to supportMathworldPlanetmathPlanetmath procedural programming and classes with inheritance to support object-oriented programming (there is also a variant of Haskell called O’Haskell which includes more support for object-oriented programming). In general, Haskell programs are most naturally written declaratively.

The standard version of the language is Haskell 98; Haskell 2007 hasn’t been released yet but is expected to be only a minor revision of Haskell 98.

The standard Haskell prelude includes the function gcd, which computes the greatest common divisorMathworldPlanetmathPlanetmath of two integers. The following Haskell code is a reimplementation of the gcd function.

-- gcd.hs -- compute the gcd of two integers-- View this page in TeX mode for documentation and license.mygcd :: Int -> Int -> Intmygcd m n  | (n < 0)   = mygcd m (abs n)  | (n == 0)  = m  | (m < n)   = mygcd n m  | otherwise = mygcd n (mymod m n)mydiv :: Int -> Int -> Intmydiv m n  | (m < 0)   = negate (mydiv (negate m) n)  | (n < 0)   = negate (mydiv m (negate n))  | (m < n)   = 0  | otherwise = 1 + mydiv (m-n) nmymod :: Int -> Int -> Intmymod m n = m - n * (mydiv m n)
随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/5 0:26:06