学习: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 ...
随机推荐
- Java程序员的C++回归路(二)
接前: 之前记录的笔记,终于想起来上传完整. 第7章: 类 定义抽象数据类型 任何对成员对象的访问都可以解释为使用this来访问,即this->member. =default :默认构造函数. ...
- android判断服务是否是运行状态
/** * 判断服务是否处于运行状态. * @param servicename * @param context * @return */ public static boolean isServi ...
- ant design pro(二)布局
一.概述 参看地址:https://pro.ant.design/docs/layout-cn 其实在上述地址ant-design上已经有详细介绍,本文知识简述概要. 页面整体布局是一个产品最外层的框 ...
- spring.xml从外部文件引入数据库配置信息
<!-- 分散配置 --> <context:property-placeholder location="classpath:jdbc.properties" ...
- EntityFramework~~~三种模式
1:database-first 2:model-first 3:code-only 此处的code-only也就是大家叫的code-first,但是正确的叫法应该是code-only
- Java Socket网络编程Client端详解
此类实现客户端套接字(也可以就叫“套接字”).套接字是两台机器之间的通信端点. Socket client = new Socket(ip,port);//创建一个流套接字并将其连接到指定 IP 地址 ...
- [Windows驱动开发](三)基础知识——驱动例程
一.NT式驱动的基本例程 1. 驱动入口函数——DriverEntry // 驱动程序的一般性定义 NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObje ...
- java中GET方式提交和POST方式提交
java中GET方式提交的示例: /** * 获取关注列表; * @return */ @SuppressWarnings("unchecked") public static A ...
- unity, 设置帧率上限
用unity做了个demo,把所有开销大的特效都去了,在真机上运行仍然卡.显示帧率来看,最高到30.原来unity在ios设备上帧率默认限制为不超过30. 可以通过Application.target ...
- 基于socket.io的实时消息推送
用户访问Web站点的过程是基于HTTP协议的,而HTTP协议的工作模式是:请求-响应,客户端发出访问请求,服务器端以资源数据响应请求. 也就是说,服务器端始终是被动的,即使服务器端的资源数据发生变化, ...