Science Fair Projects Ideas - Erlang programming language

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Erlang programming language

Erlang is a general-purpose concurrent programming language and runtime system. The sequential sub-set of Erlang is a functional language, with strict evaluation, single assignment and dynamic typing. It was designed at Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications.

It is named after A. K. Erlang. It is sometimes mistakenly thought that its name is as abbreviation of ERicsson LANGuage, owing to its heavy use inside Ericsson.


Contents

Functional language

Code looks like this:

-module(fact).
-export([fac/1]).

fac(0) -> 1;
fac(N) where N > 0 -> N * fac(N-1).

Below is an implementation of a Quicksort algorithm.

%% quicksort(List)
%% Sort a list of items
-module(quicksort).
-export([qsort/1]).

qsort([]) -> [];
qsort([Pivot|Rest]) ->
    qsort([ X || X <- Rest, X < Pivot]) ++ [Pivot] ++ qsort([ Y || Y <- Rest, Y >= Pivot]).

The above example recursively calls the function qsort until there is no more to be sorted. The expression [ X || X <- Rest, X < Pivot] can be read as "Chose all X where X is a member of Rest and X is less then Pivot", resulting in a very easy way of handling Lists. Since you can evaluate any boolean expression between two different datatypes, the evaluation is straight forward - for example, 1 < a will return true.

However, a compare function can be used if the order on which Erlang bases its return value (true or false) needs to be changed. For example, if we would want an ordered list where a > 1 evaluates true.

Concurrency oriented language

Main strength of Erlang is support for concurrency. It has small but powerful set of primitives to create threads and communicate between them. Location of thread is transparent (it can be within the same operating system process or on different computer).

Code examples:

 Pid = spawn(Mod, Func, Args)     % execute function Func as new thread
 Pid ! a_message      % send message to the thread (asynchronously)
 receive       % receive message sent to this thread
   a_message -> do_something
 end.

Erlang contains mechanisms to deal with errors and to ensure high availability of the whole system. Dynamical replacement of code (hot swapping) is supported.

Distribution

Erlang was released as open source to ensure its dependence on single source and to increase awareness of the language. Distribution of the language together with libraries and real-time distributed database is known as Open Telecom Platform , OTP. Ericsson offers commercial support for Erlang.

Since taking the open source path in 1998, it became used by several companies world-wide, including Nortel and T-Mobile. However, it didn't and hasn't yet become a wide-spread mainstream programming language.

As of 2005, Erlang is under active development with regular releases. It is available for several Unix-like operating systems and Windows.

Advantages

  • superb support for concurrency (it is no problem to create hundreds of thousands of threads)
  • high programmer productivity (Ericsson study claim 4x higher than C)
  • small and simple to learn: Erlang is not academic language but real-world tool designed to be useable by Ericsson programmers
  • scalability: large systems with millions lines of code were written in Erlang

Disadvantages

  • not intended for high-performance applications (interpreted language, uses garbage collection)
  • lack of static typing: many errors are caught only during runtime (over time the compiler is improves to catch more typing errors, though)
  • as it is not a mainstream language there are not many tools, books, libraries and skilled developers. For example GUI support is still in the beginning.

See also

  • ejabberd, an instant messaging server written in Erlang.
  • Wings 3D, 3D modeller written in Erlang.
  • Yet another web server (YAWS, fully featured Web server written in Erlang)

External links

09-23-2007 01:00:40
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice