< Erlang (programming language) | TutorialsRevision as of 06:07, 8 August 2009 by imported>Tom Morris
The metadata subpage is missing. You can start it via filling in this form or by following the instructions that come up after clicking on the [show] link to the right.
|
Do you see this on PREVIEW? then SAVE! before following a link.
A - For a New Cluster use the following directions
Subpages format requires a metadata page.
Using the following instructions will complete the process of creating this article's subpages.
- Click the blue "metadata template" link below to create the page.
- On the edit page that appears paste in the article's title across from "
pagename = ".
- You might also fill out the checklist part of the form. Ignore the rest.
- For background, see Using the Subpages template Don't worry--you'll get the hang of it right away.
- Remember to hit Save!
the "metadata template".
However, you can create articles without subpages. Just delete the {{subpages}} template from the top of this page and this prompt will disappear. :) Don't feel obligated to use subpages, it's more important that you write sentences, which you can always do without writing fancy code.
|
B - For a Cluster Move use the following directions
The metadata template should be moved to the new name as the first step. Please revert this move and start by using the Move Cluster link at the top left of the talk page.
The name prior to this move can be found at the following link.
|
|
Expressions
Erlang statements look a little like sentences. A statement is a series of comma separated expressions ending with a period. Erlang expressions can either be ignored, stored, or returned depending on their position and structure of a statement.
4+3, H=6-2, lists:reverse([3,4,5]).
[5,4,3]
In this Erlang example the expression: 4+3 is computed, the expression H=6-2 is computed, and the reverse of the list [3,4,5] is computed and returned. The results of 4+3 are ignored and the pattern 4 is matched to the variable H. For ever-after H will have the unchangeable value 4. "lists" is the name of a standard module(library) that provides list utility functions.
Problems:
1) write an expression that matches the pattern H2 to the reverse of the list [{1,2},{2,1}].
2) write an expression that matches the pattern H3 to the length of the list [{1,2},{2,1}].
3) write and expression that matches the pattern H4 to the length of the flattened version of the list [{1,2},{2,1}].