学习:record用法
详情请参考官网:http://www.erlang.org/doc/reference_manual/records.html
http://www.erlang.org/doc/programming_examples/records.html
1. record本质上是tuple.
2.获取record的结构相关的信息的函数:
To each module using records, a pseudo function is added during compilation to obtain information about records:
record_info(fields, Record) -> [Field]
record_info(size, Record) -> Size
Size is the size of the tuple representation, that is one more than the number of fields.
In addition, #Record.Name returns the index in the tuple representation of Name of the record Record. Name must be an atom.
1> rd(state,{age,sex}).
state
2> State = #state{age = 27,sex = 1}.
#state{age = 27,sex = 1}
3> State.
#state{age = 27,sex = 1}
4> io:format("~w~n",[State]).
{state,27,1}
ok
5> tuple_to_list(State).
[state,27,1]
6> NewState = State#state{age=28}.
#state{age = 28,sex = 1}
7> State#state.age.
27
9> record_info(fields,state).
[age,sex]
10> record_info(size,state).
3
rd():在控制台中定义record.
学习:record用法的更多相关文章
- Python新手学习raise用法
当程序出现错误时,系统会自动引发异常.除此之外,Python也允许程序自行引发异常,自行引发异常使用 raise 语句来完成. 很多时候,系统是否要引发异常,可能需要根据应用的业务需求来决定,如果程序 ...
- ReactiveCocoa学习笔记--用法
1.监测UI变量的变化 return 后把值传递下去. 1.1.输出 [self.usernameTextField.rac_textSignal subscribeNext:^(id x){ NSL ...
- Vue2.0学习——axios用法详解
功能特性 在浏览器中发送 XMLHttpRequests 请求 在 node.js 中发送 http请求 支持 Promise API 拦截请求和响应 转换请求和响应数据 自动转换 JSON 数据 客 ...
- MarkDown学习——基础用法
目录 MarkDown开发版本MD2All基础用法 此处有代码<a id="top"></a>作为页内锚点 此处是用自动生成的目录 MarkDown是什么M ...
- MVC ---- 理解学习Func用法
//Func用法 public static class FuncDemo{ public static void TestFunc(){ //数据源 List<User> usList ...
- 从0开始 Java学习 packet用法
packet 包的用法 参考博客:https://www.cnblogs.com/Ring1981/p/6240412.html 用法 java 源文件带有包名,往往容易出错 如:H:\code\He ...
- pl/sql中的record用法
create or replace procedure pro1(v_in_empno in number) is --定义一个记录数据类型 type my_emp_record is record( ...
- STL源代码学习--vector用法汇总
一.容器vector 使用vector你必须包含头文件<vector>: #include<vector> 型别vector是一个定义于namespace std内的templ ...
- 零基础学习java------day15--------collections用法,比较器,Set(TreeSet,TreeMap),异常
1. Collections用法 Collections: 集合的工具类public static <T> void sort(List<T> list) 排序,升序publi ...
随机推荐
- 【转】MVC4验证用户登录特性实现方法
在开发过程中,需要用户登陆才能访问指定的页面这种功能,微软已经提供了这个特性. // 摘要: // 表示一个特性,该特性用于限制调用方对操作方法的访问. [AttributeUsage(Attribu ...
- 〖Android〗CM10.2编译错误解决
错误1: hardware/samsung/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp: In function 'int android::hd ...
- spring AOP编程--AspectJ注解方式
1. AOP 简介 AOP(Aspect-Oriented Programming, 面向切面编程): 是一种新的方法论, 是对传统 OOP(Object-Oriented Programming, ...
- 初始化列表(const和引用成员)、拷贝构造函数
一.构造函数初始化列表 推荐在构造函数初始化列表中进行初始化 构造函数的执行分为两个阶段 初始化段 普通计算段 (一).对象成员及其初始化 C++ Code 1 2 3 4 5 6 7 8 9 1 ...
- mysql numberic types ---- mysql 数值类型详解
编程语言中大多都有数据类型一说.虽然mysql 的sql 语句与标准sql 有别.但是宏观上看还是差不多的:下面我们说一下mysql数据库中的数值类型 一.在mysql里有那些类型可以表示数值: 1. ...
- min宏的学习
1.先上实现代码: #define __min(t1, t2, min1, min2, x, y) ({ \ t1 min1 = (x); \ t2 min2 = (y); \ (void) (&am ...
- linux kill 关闭进程命令
杀死进程最安全的方法是单纯使用kill命令,不加修饰符,不带标志. 首先使用ps -ef命令确定要杀死进程的PID,然后输入以下命令: # kill -pid 注释:标准的kill命令通常都能达到目的 ...
- atitit.集合的filt操作细分 filter总结
atitit.集合的filt操作细分 filter总结 1. Css sltr 1 2. 基本选择器(根据id,class,元素名) 2 3. 层次选择器 3 4. 过滤选择器 3 5. First, ...
- PCI-Express协议传输层读书笔记
http://www.doczj.com/doc/35cb19633169a4517723a3d9-9.html
- 17. Subsets【medium】
Given a set of distinct integers, return all possible subsets. Notice Elements in a subset must be i ...