some important explanation

本文探讨了Erlang中元组和列表的应用场景,解释了如何使用元组来代替其他语言中的记录或结构体,并说明了列表适用于大小可变的数据结构。此外,文章还介绍了Erlang中字符串的表示方法,以及守卫表达式的限制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    In general we can say we use tuples where we would use "records" or "structs" in other languages and we use lists when we want to represent things which have varying sizes, (i.e. where we would use linked lists in other languages).


    Erlang does not have a string date type, instead strings can be represented by lists of ASCII characters. So the list[97,98,99] is equivalent to "abc". The Erlang shell is "clever" and guesses the what sort of list we mean and outputs it in what it thinks is the most appropriate form, for example:

30> [97,98,99].
"abc"

Only a few built in functions can be used in guards, and you cannot use functions you have defined yourself in guards. (Aside for advanced readers: This is to ensure that guards don't have side effects).


~p Writes the data with standard syntax in the same way as ~w, but breaks terms whose printed representation is longer than one line into many lines and indents each line sensibly. It also tries to detect lists of printable characters and to output these as strings.(求翻译)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值