O'Reilly logo

Introducing Erlang, 2nd Edition by Simon St. Laurent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. An Erlang Parts Catalog

Like every language, Erlang has drawers full of parts that are fun to peruse. These are a very few of the more common ones. For much much more, see http://bitly.com/10CiiKR.

Shell Commands

You can use most Erlang functions from the shell, but these are ones that are exclusive to the shell.

Table A-1. Erlang shell commands
Command Action

q()

Quits the shell and the Erlang runtime

c(file)

Compiles the specified Erlang file

b()

Displays all variable bindings

f()

Clears all variable bindings

f(X)

Clears specified variable binding

h()

Prints the history list of commands

e(N)

Repeats the command on line N

v(N)

The return value of line N

catch_exception(boolean)

Sets how strict the shell will be in passing errors

rd(Name,Definition)

Defines a record type Name with contents specified by Definition

rr(File)

Defines record types based on the contents of File

rf()

Clears all record definitions. Can also clear specific definitions

rl()

Lists all current record definitions

pwd()

Gets the present working directory

ls()

Lists files at the current location

cd(Directory)

Changes to the specified Directory

Reserved Words

There are a few Erlang terms you can’t use outside of their intended context.

The Erlang compiler will wonder what you’re trying to do if you use certain keywords as atoms or function names. It will try to treat your atoms as if they were code, and you can get very strange errors. After all, you should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required