Liste in Haskell

From HaskellWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


. Programul

lis1 = [1]
lis2 = 2:lis1
lis3 = ['a']
lis4 = 'b':lis3

Salvati-l cu un nume cum ar fi: liste.hs

. Si executia lui

Se incarca in Hugs, interpretorul de Haskell cu: hugs liste .hs

__   __ __  __  ____   ___      _________________________________________
||   || ||  || ||  || ||__      Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__||  __||     Copyright (c) 1994-2005
||---||         ___||           World Wide Web: http://haskell.org/hugs
||   ||                         Bugs: http://hackage.haskell.org/trac/hugs
||   || Version: September 2006 _________________________________________

Haskell 98 mode: Restart with command line option -98 to enable extensions

Type :? for help
Main> lis1
[1]
Main> lis2
[2,1]
Main> lis3
"a"
Main> lis4
"ba"
Main> head lis1
1
Main> head lis2
2
Main> tail lis2
[1]