Tutorial by Examples

A syntactic extension that allows applying the tuple constructor (which is an operator) in a section way: (a,b) == (,) a b -- With TupleSections (a,b) == (,) a b == (a,) b == (,b) a N-tuples It also works for tuples with arity greater than two (,2,) 1 3 == (1,2,3) Mapping This can be u...
An extension that allows you to use Unicode characters in lieu of certain built-in operators and names. ASCIIUnicodeUse(s)::∷has type->→function types, lambdas, case branches, etc.=>⇒class constraintsforall∀explicit polymorphism<-←do notation*★the type (or kind) of types (e.g., Int :: ★)&g...
Standard Haskell allows you to write integer literals in decimal (without any prefix), hexadecimal (preceded by 0x or 0X), and octal (preceded by 0o or 0O). The BinaryLiterals extension adds the option of binary (preceded by 0b or 0B). 0b1111 == 15 -- evaluates to: True
This is a type system extension that allows types that are existentially quantified, or, in other words, have type variables that only get instantiated at runtime†. A value of existential type is similar to an abstract-base-class reference in OO languages: you don't know the exact type in contains,...
The following expressions are sequenced: a && b a || b a , b a ? b : c for ( a ; b ; c ) { ... } In all cases, the expression a is fully evaluated and all side effects are applied before either b or c are evaluated. In the fourth case, only one of b or c will be evaluated. In the l...
C11 The following expressions are unsequenced: a + b; a - b; a * b; a / b; a % b; a & b; a | b; In the above examples, the expression a may be evaluated before or after the expression b, b may be evaluated before a, or they may even be intermixed if they correspond to several instruct...
Originally proposed by Vincent Driessen, Gitflow is a development workflow using git and several pre-defined branches. This can seen as a special case of the Feature Branch Workflow. The idea of this one is to have separate branches reserved for specific parts in development: master branch is al...
This type of workflow is fundamentally different than the other ones mentioned on this topic. Instead of having one centralized repo that all developers have access to, each developer has his/her own repo that is forked from the main repo. The advantage of this is that developers can post to their o...
With this fundamental workflow model, a master branch contains all active development. Contributors will need to be especially sure they pull the latest changes before continuing development, for this branch will be changing rapidly. Everyone has access to this repo and can commit changes right to t...
Database transactions ensure that a set of data changes will only be made permanent if every statement is successful. Any query or code failure during a transaction can be caught and you then have the option to roll back the attempted changes. PDO provides simple methods for beginning, committing,...
In this example, documentation for the local function baz (defined in foo.m) can be accessed either by the resulting link in help foo, or directly through help foo>baz. function bar = foo %This is documentation for FOO. % See also foo>baz % This wont be printed, because there is a line w...
On OS X and MacOS, Elixir can be installed via the common package managers: Homebrew $ brew update $ brew install elixir Macports $ sudo port install elixir
In C++, sequences of characters are represented by specializing the std::basic_string class with a native character type. The two major collections defined by the standard library are std::string and std::wstring: std::string is built with elements of type char std::wstring is built with e...
<!doctype html> <html> <head> <title>Example Page</title> </head> <body> <% 'This is where the ASP code begins 'ASP will generate the HTML that is passed to the browser 'A single quote denotes a comment, so these lines are not exe...
Keyword lists are lists where each item in the list is a tuple of an atom followed by a value. keyword_list = [{:a, 123}, {:b, 456}, {:c, 789}] A shorthand notation for writing keyword lists is as follows: keyword_list = [a: 123, b: 456, c: 789] Keyword lists are useful for creating ordered ...
Strings in Elixir are "binaries". However, in Erlang code, strings are traditionally "char lists", so when calling Erlang functions, you may have to use char lists instead of regular Elixir strings. While regular strings are written using double quotes ", char lists are wr...
Lists in Elixir are linked lists. This means that each item in a list consists of a value, followed by a pointer to the next item in the list. This is implemented in Elixir using cons cells. Cons cells are simple data structures with a "left" and a "right" value, or a "he...
map is a function in functional programming which given a list and a function, returns a new list with the function applied to each item in that list. In Elixir, the map/2 function is in the Enum module. iex> Enum.map([1, 2, 3, 4], fn(x) -> x + 1 end) [2, 3, 4, 5] Using the alternative c...
As seen in "Lambda Functions", functions can take other functions as a parameter. The "function type" which you'll need to declare functions which take other functions is as follows: # Takes no parameters and returns anything () -> Any? # Takes a string and an integer a...
Lambda functions are anonymous functions which are usually created during a function call to act as a function parameter. They are declared by surrounding expressions with {braces} - if arguments are needed, these are put before an arrow ->. { name: String -> "Your name is $name&q...

Page 158 of 1336