Liste in Haskell

From HaskellWiki
Revision as of 20:56, 28 March 2011 by Ha$kell (talk | contribs) (New page: Category:Ro ==. Programul == <haskell> lis1 = [1] lis2 = 2:lis1 lis3 = ['a'] lis4 = 'b':lis3 </haskell> Salvati-l cu un nume cum ar fi: ''liste.hs'' ==. Si executia lui == Se inca...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


. 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]