With Erlang is the principal creating of a database management system (DBMS) relatively easy to deal with.
This also speaks, that some databases in Erlang are designed:
- CouchDB
- SimpleDB
But other well-known projects.
With Erlang is the principal creating of a database management system (DBMS) relatively easy to deal with.
This also speaks, that some databases in Erlang are designed:
But other well-known projects.
In Erlang elegantly and quickly be able to generate a list of numbers much code, it surrounds the special construct of the list comprehension.
They are used mostly in the following cases:
[Expression || Generaotor1, Guard11,...GuardN1, Generator2, Guard12,......GeneraotorM, Guard1M,...GuardNM,]
Expression: Specifies the result item in the result list
Generator: similar to a for loop, where each item in the list is iterated: Syntax: Element<-List
Guards: have a filter function, It determines, If an item in the results list ends up
[X||X<-[1,2,3,4]]. [1,2,3,4]
[X||X<-[1,2,3,4], X < 3]. [1,2]
[X||X<-[1,2,3,4], X rem 2 == 0]. [2,4]
With Erlang very easily distributed code can be written, can on different threads running without problems.
Erlang the language of choice is therefore to write distributed applications.
Task: 2520 is the smallest number, by any number of 1-10 can be evenly divided. What is the smallest positive number, by all of the numbers 1-20 evenly divisible? It is to be programmed, the Brute Force variant.
Solution:
-module(kleinsterAllesTeiler). -compile(export_all). kleinsterAllesTeiler(X) -> kleinsterAllesTeiler(X, 2, X). kleinsterAllesTeiler(X, Teiler, KleinsteSuperZahl) when (Teiler > X) -> KleinsteSuperZahl; kleinsterAllesTeiler(X, Teiler, KleinsteSuperZahl)-> %io:fwrite("X: ~w \t Teiler: ~w \t KleinsteSuperZahl: ~w\n", [X, Teiler, KleinsteSuperZahl]), case teilbar(KleinsteSuperZahl, Teiler) of true ->kleinsterAllesTeiler(X, Teiler + 1, KleinsteSuperZahl); false ->kleinsterAllesTeiler(X, 2, KleinsteSuperZahl + 1) end. teilbar(X, Teiler) when (X rem Teiler) == 0 -> true; teilbar(X, Teiler) -> false.
For professional development with Erlang, various editors and IDEs available: Overview see item 7.7. Sorry, could not convince me of the Eclipse Plugin and the Netbeans plugin lies not install and Netbeans 7, which is why I use Notepad for developing (see below).
Bsp. Applications written in Erlang: