Erlang

Código Fuente

casiano@exthost2:~/src/LPP/170912/erlang (master)$ ls
factorial.beam  factorial.erl  README

casiano@exthost2:~/src/LPP/170912/erlang (master)$ cat factorial.erl 
-module(factorial).
-export([fac/1]).

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

casiano@exthost2:~/src/LPP/170912/erlang (master)$ erl
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] 
                           [hipe] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> c(factorial).
{ok,factorial}
2> factorial:fac(4). 
24
3> halt().

Quicksort en Erlang

-module( quicksort ).
 
-export( [qsort/1] ).
 
qsort([]) -> [];
qsort([X|Xs]) ->
   qsort([ Y || Y <- Xs, Y < X]) ++ [X] ++ qsort([ Y || Y <- Xs, Y >= X]).



Subsecciones

Casiano Rodriguez León 2015-01-07