Category:Erlang
-
Time:2019-3-31
Matching in Assignment Atom matching Copy codeThe code is as follows: atom = atom % atom another = another % another atom = another % exception error Variable matching Copy codeThe code is as follows: Var = 2. % 2 Var = 3 – 1. % 2 Var = 1. % exception error Tuple matching […]
-
Time:2019-3-30
Process in Erlang – Processes are lightweight and not shared between processes. Looking up a lot of information, it seems that no one knows what the concept of lightweight process is and continues to look for it. Gossip aside, into the world of concurrent programming. This is a learning note, or a brief translation of […]
-
Time:2019-3-29
Erlang‘s modules for manipulating file I/O are: File module: The methods of opening, reading, writing and closing the directory where the file has been operated are basically here. Filename module: Provides a platform-independent way to manipulate file names Filelib Module: Extension of File Module, which provides more practical tools to build on File Module IO […]
-
Time:2019-3-28
1: Variables 1. Variables in Erlang [single assignment] mean that variables can only be assigned once.2. Variables must begin with capital letters. Two: Atoms Atoms are equivalent to enumeration types in c++, but the value of atoms in Erlang is itself. Atoms begin with a bunch of lower-case letters, but if they are given a […]
-
Time:2019-3-27
1: function 1: In Erlang, the two functions with the same name but different number of parameters are completely different functions. 2: Functions in other modules are called with fully qualified names: Copy codeThe code is as follows: -module(sort1). -export([reverse_sort/1, sort/1]). reverse_sort(L) -> lists1:reverse(sort(L)). sort(L) -> lists:sort(L). 3: The clauses are separated by […]
-
Time:2019-3-26
Erlang has three ways to produce random numbers random:uniform(). This function is provided by the random module of the Erlang library. This is generally used. Copy codeThe code is as follows: 1> random:uniform(). 0.4435846174457203 erlang:now(). Use the current time as a random belief that many people have done it. So if you don’t have too […]
-
Time:2019-3-25
os.cmd(Cmd) OS module provides CMD functions to execute Linux system shell commands (or windows commands). Returns the standard output string result of a Cmd command. For example, in a Linux system, os: CMD (“date”) is executed. The time when Linux is returned. This is relatively simple, in general, but also to meet most of the […]
-
Time:2019-3-24
Erlang is now part of the Fedora and Debian/Ubuntu software repositories. The latest version of Erlang is OTP 17.0. Erlang is a programming language for building large-scale, highly scalable and highly available soft real-time systems. It has been used in telecommunications, finance, e-commerce, Internet telephony and instant messaging. Erlang’s runtime system has built-in support for […]
-
Time:2019-3-23
As projects become more reliant on Erlang, the number of problems they encounter increases. Some time ago, the online system encountered the problem of high memory consumption. Record the Troubleshooting Analysis process. The online system uses Erlang R16B02. Problem description There are several online systems that run for a period of time and memory soars. […]
-
Time:2019-3-22
As mentioned in the previous article, the atoms associated with the registration process have a global scope, which refers to the current Erlang virtual machine, which is the current distributed node in the distributed mode. Therefore, the atoms associated with the registration process in one node can not be used directly in another node, but […]
-
Time:2019-3-21
Baidu cloud push official address http://developer.baidu.com/wiki/index.php?Title=docs/cplat/push The following principles are briefly introduced: Baidu cloud push supports IOS and Android cloud push. Android support is good, but IOS is generally difficult to tune in. Baidu cloud for IOS push, he just acts as an intermediary agent, providing interface for users, the advantage is using Baidu cloud […]
-
Time:2019-3-20
guard Guard can be separated by commas or semicolons, which represent the final result of each guard and the final result is true as long as any guard is true. Copy codeThe code is as follows: guard(X, Y) when not(X>Y), is_atom(X) -> X + Y. Guard can filter elements in list comprehension: Copy codeThe […]