This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(examples). | |
| -export([take/2, take/2]). | |
| take(N, L) when N =:= 0 -> | |
| []; | |
| take(_N, []) -> | |
| []; | |
| take(N, [X|Xs]) -> | |
| [X | take(N-1, Xs)]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(constructing). | |
| -export([ evens/1, double/1, median/1]). | |
| % Define an Erlang function double/1 to double the elements of a list of numbers. | |
| double([])-> | |
| []; | |
| double([X | Xs]) -> | |
| [X * 2 | double(Xs)]. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(listas). | |
| -export([sum/1, product/1, product_tail/1, maximum/1, maximum_tail/1]). | |
| sum([]) -> | |
| 0; | |
| sum([X|Xs]) -> | |
| X + sum(Xs). | |
| % The product of a list of numbers | |
| % With direct recursion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(exercises). | |
| -export([area/1, perimeter/1, enclose/1, bits/1, | |
| area_circle_test/0, | |
| area_rectangle_test/0, | |
| area_triangle_test/0, | |
| perimeter_circle_test/0, | |
| perimeter_rectangle_test/0, | |
| perimeter_triangle_test/0 | |
| ]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(tailrecursion). | |
| -export([fib/1, perfect/1]). | |
| % fib(4)= | |
| % t | (N-1) | F1 | F1 + F2 | | |
| % 0 | 4 | 0 | (0 + 1) | | |
| % 1 | 3 | 1 | (0 + 1) | | |
| % 4 | 2 | 1 | (1 + 1) | | |
| % 3 | 1 | 2 | (1 + 2) | | |
| % 4 | 0 | 3 | (2 + 3) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(recursion). | |
| -export([fac/1, fib/1, pieces/1]). | |
| %Factorial | |
| fac(0) -> | |
| 1; | |
| fac(N) -> | |
| fac(N-1)*N. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(homework). | |
| -export([xOr/2, xOr_v1/2, xOr_v2/2, xOr_v3/2, xOr_v4/2, xOr_v5/2, maxThree/3, howManyEqual/3, test1/0]). | |
| % Exclusive or | |
| xOr(true, flase) -> | |
| true; | |
| xOr(false, true) -> | |
| true; | |
| xOr(_, _) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(first). | |
| -export([double/1, mult/2, area/3, square/1, treble/1]). | |
| mult(X, Y) -> | |
| X*Y. | |
| double(X) -> | |
| mult(2, X). | |
| area(A, B, C) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <profiles version="10"> | |
| <profile name="MPRG" version="10"> | |
| <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> | |
| <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package mx.gob.poderjudicialdf.simj.constants; | |
| public enum TipoBusquedaEjecutorEnum { | |
| POR_NOMBRE(1l, "Por nombre"), ACTIVOS(2l, "Activos"), INACTIVOS(3l, "Inactivos"); | |
| private long id; | |
| private String descripcionBusqueda; | |
| private TipoBusquedaEjecutorEnum(long id, String descripcionBusqueda) { |