学习: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 ...
随机推荐
- SpringMVC请求参数和响应结果全局加密和解密
前提 前段时间在做一个对外的网关项目,涉及到加密和解密模块,这里详细分析解决方案和适用的场景.为了模拟真实的交互场景,先定制一下整个交互流程.第三方传输(包括请求和响应)数据报文包括三个部分: 1.t ...
- 阿里云服务器 centos7 ftp安装
昨天租了阿里云服务器一个月,想玩一下linux系统,结果想用ftp上传本地文件的时候,发现用不了,结果在安装配置的时候折腾了几个小时,在网上查了无数的资料,有的说要改配置文件,有的说要关防火墙,说啥的 ...
- QtGui.QComboBox
The QtGui.QComboBox is a widget that allows a user to choose from a list of options. #!/usr/bin/pyth ...
- Be Happy.——我的ACM退役贴
一个月的忙碌后,最终能静下心来写一些什么. 该结束的最终都要结束了.考试,课程设计,所剩寥寥无几的大学时光,ACM. 看过不少大牛的退役贴,自嘲成银牌狗铜牌狗.写一写碎碎念,大抵如此,每一个人都无法落 ...
- iOS GZWaterfall任何形式的瀑布流
概述 使用UICollectionView可以布局各种各样的瀑布流,下面我写了几种不同布局的瀑布流样式 详细 代码下载:http://www.demodashi.com/demo/11018.html ...
- Android开发之定位系统
2013-07-04 定位系统 全球定位系统(Global Positioning System, GPS), 又称全球卫星定位系统. 最少只需其中3颗卫星,就能迅速确定用户组地球所处的位置及海拔高度 ...
- Ruby 和 Python 分析器是如何工作的?
你好! 我作为一名编写Ruby profiler的先驱,我想对现有的Ruby和Python profiler如何工作进行一次调查. 这也有助于回答很多人的问题:“你怎么写一个profiler?” 在这 ...
- 【LeetCode】85. Maximal Rectangle
Maximal Rectangle Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle conta ...
- android的通知栏的实现
package com.example.mynotification; import android.os.Bundle; import android.app.Activity; import an ...
- Python操作redis系列以 哈希(Hash)命令详解(四)
# -*- coding: utf-8 -*- import redis #这个redis不能用,请根据自己的需要修改 r =redis.Redis(host=") 1. Hset 命令用于 ...