Mark's Logs

Reading, thinking, and seeing.

Programming Erlang Notes

0. Building

configure on os x
1
./configure --prefix=/opt --disable-debug --enable-kernel-poll --enable-threads --enable-dynamic-ssl-lib --enable-shared-zlib --enable-smp-support --enable-darwin-64bit --with-dynamic-trace=dtrace --enable-hipe

Basics

Variables

  • All variable names must start with an uppercase letter.
  • In Erlang, = denotes a pattern maching operation.

Atoms

  • atoms are used to represent different non-numerical constant values.
  • atoms starts with lowercase letters, followed by a sequence of alphanumeric characters or _, or @.
  • atmos can also be quoted with a single quotation mark.

Tuples

  • similar to structs in C.
  • the fields of a tuple have no names.
  • Person = {person, {name, joe}, {height, 1.82}}
  • extraction: {person, X, Y} = Person, {_,{_,Who},_} = Person

Lists

  • created by enclosing the list elements in square brackets and seperating them with commas.
  • if T is a list, then [H|T] is also a list, with head H and tail T. [] is the empty list.
  • [H1, H2, ..., Hn | T]
  • extraction: [What|Left] = TheList

Strings

  • Strings are really just lists of integers.
  • Strings are enclosed in double quotation marks.
  • dollar syntax: [I-32,$u,$r,$p,$r,$i,$s,$e]

Pattern Matching

  • f() tells the shell to forget any bindings it has.

Sequential Programming

chapter 3, 5

Exceptions

chapter 4

Comipling and Running

chapter 6

Concurrenct Programming

chapter 7, 8, 9

Distributed Programming

chapter 10

Interfacing Techniques

chapter 12

Programming with Files/Sockets

chapter 13, 14

OTP

chapter 16, 18

Multicore Programming

chapter 19, 20

Comments