资源描述:
《Basic Erlang》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、DataTypes:integers0•B#Valisusedtostore10numbersinbaseB100000000-234•$Charisusedforasciivalues16#AB10F2#1010-$Aisequivalentto65$a•Largeintegersare$Aconvertedtobignums$•MaxsizedependsonErlangSolutionsLtd.physicalconstraints:BasicErlang-RAM-Pagingmemory©1999-2011ErlangSolutionsLtd
2、.©1999-2011ErlangSolutionsLtd.313Overview:basicErlangDataTypes:floats•BasicErlangI17.368•Notefficiently-56.654implemented-DataTypes12.34E-10•Storedasadouble-Variables-64-bitrepresentation-ComplexDataStructures•FollowstheIEEE754standard-PatternMatching•BasicErlangII•BasicErlangIII©
3、1999-2011ErlangSolutionsLtd.2©1999-2011ErlangSolutionsLtd.424Tuesday,6September2011Tuesday,6September2011DataTypes:atomsDataTypes:tuplesjanuary•Atomsareconstant{123,bcd}•TuplesareusedtodenotefooBarliterals{123,def,abc}data-typeswithafixedalfa21{abc,{def,123},ghi}numberofitemsstar
4、t_with_lower_case•Startwithalowercase{}node@ramoneletterorareencapsulated{person,'Joe','Armstrong'}•Tuplesofanysizearetrueby''{person,'Mike','Williams'}allowedfalse•Anycharactercodeis•ContainvalidErlangallowedwithinanatomifexpressions'January'using'''aspace''Anythinginsidequotes{
5、}#@•Letters,integersand_are 12'allowediftheatomstarts'node@ramone.erlang.org'withalowercaseletter©1999-2011ErlangSolutionsLtd.5©1999-2011ErlangSolutionsLtd.757DataTypes:booleansDataTypes:liststrue•Noseparatetypefor[1,2,3,4,5,6,7,eight,nine]falsebooleans:atomstrueand1==2falsear
6、eusedinstead.1/=21==1.0•Operators(and,andalso,1=:=1or,orelse,xor,not)accept1=/=1.0trueandfalseasifthey1<2actuallywereboolean•Listsarewrittenbeginningwitha[andendingwitha]a>ztypes.less7、e)•Listsaredynamicallysizednot((1<3)and(2==2))not((1<3)or(2==2))•StringsinErlangarelistsofASCIIvaluesnot((1<3)xor(2==2))©1999-2011ErlangSolutionsLtd.6©1999-2011ErlangSolutionsLtd.868Tuesday,6September2011Tuesday,6September2011DataTypes:listsDataTypes:lists[january,february,march]
8、[one,two,three,four][123,def,abc][one,tw