Liste in Haskell
. Programul[edit]
lis1 = [1]
lis2 = 2:lis1
lis3 = ['a']
lis4 = 'b':lis3
Salvati-l cu un nume cum ar fi: liste.hs
. Si executia lui[edit]
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]