1. 快速浏览3.1.3节,然后测试并记忆这些行编辑命令
| 命令 | 说明 | 助记法 | 
|---|---|---|
| ^A | 行首 | A为第一个字母 | 
| ^D | 删除当前字符 | D为Delete | 
| ^E | 行尾 | E为End | 
| ^F | 向前的字符 | F为Forward | 
| ^B | 向后的字符 | B为Back | 
| ^P | 前一行 | P为Preceding | 
| ^N | 下一行 | N为Next | 
| ^T | 调换最近两个字符的位置 | T为Transposition | 
| Tab | 尝试扩展当前模块或函数的名称 | 
^在Mac中按键为:Control
2. 在shell里面输入help()命令。你将看到一长串命令。可以试一试其中一些命令。
| 1 | yfydemacbook-pro:opensource yfy$ erl | 
3. 试着用一个元组来表示一座房子,再用一个房子列表来表示一条街道。请确保你能向这些结构中加入数据或从中取出数据。
Erlang的所有数据类型:Data Types
| 类型 | 说明 | 
|---|---|
| Terms | A piece of data of any data type | 
| Number | two types of numeric literals, integers and floats | 
| Atom | An atom is a literal, a constant with name 如果是以大写字母开前头则需要用’’号括起来 | 
| Bit Strings and Binaries | A bit string is used to store an area of untyped memory. | 
| Reference | A reference is a term that is unique in an Erlang runtime system | 
| Fun | A fun is a functional object. | 
| Port Identifier | A port identifier identifies an Erlang port. | 
| Pid | A process identifier, pid, identifies a process. | 
| Tuple | A tuple is a compound data type with a fixed number of terms. | 
| Map | A map is a compound data type with a variable number of key-value associations. | 
| List | A list is a compound data type with a variable number of terms. | 
| String | Strings are enclosed in double quotes (“), but is not a data type in Erlang. | 
| Record | A record is a data structure for storing a fixed number of elements. | 
| Boolean | There is no Boolean data type in Erlang. Instead the atoms true and false are used to denote Boolean values. | 
| Escape Sequences | 具体查看上面数据类型链接 | 
房子:
House1={house,{owner,yangfy1},{location,’china cq1’}}
House2={house,{owner,yangfy2},{location,’china cq2’}}
House3={house,{owner,yangfy3},{location,’china cq3’}}
街道:
ShaZhengjie=[House1,House2,House3]
| 1 | Eshell V7.2.1 (abort with ^G) | 
读取House1中location;House2的owner
| 1 | 5> {house,_,{_,D}} = House1. | 
读取街道中第二栋房子的owner
| 1 | 9> [H1,H2|H3] = ShaZhengjie. | 
为街道新增加一栋房子
House4={house,{owner,yangfy4},{location,’china cq4’}}
| 1 | 12> House4={house,{owner,yangfy4},{location,'china cq4'}}. |