Tutorial by Examples: er

Guard patterns can be used to check that a value satisfies an arbitrary test-form. (dotimes (i 5) (format t "~d: ~a~%" i (match i ((guard x (oddp x)) "Odd!") (_ "Even!")))) ; 0: Even! ; 1: Odd! ; 2: Even! ; 3: Odd! ; 4: ...
CL-PPCRE:REGISTER-GROUPS-BIND will match a string against a regular expression, and if it matches, bind register groups in the regex to variables. If the string does not match, NIL is returned. (defun parse-date-string (date-string) (cl-ppcre:register-groups-bind (year month day) (...
A pointer to base class can be converted to a pointer to derived class using static_cast. static_cast does not do any run-time checking and can lead to undefined behaviour when the pointer does not actually point to the desired type. struct Base {}; struct Derived : Base {}; Derived d; Base* p1 ...
The shell provisioner runs a shell script when provisioning. $setup = <<SETUP # You can write your shell script between here ... sudo echo "Hello, World!" > /etc/motd.tail # ... and here. SETUP Vagrant.configure("2") do |config| config.vm.box = "ubuntu/tr...
If logic of generic class or method requires checking equality of values having generic type, use EqualityComparer<TType>.Default property: public void Foo<TBar>(TBar arg1, TBar arg2) { var comparer = EqualityComparer<TBar>.Default; if (comparer.Equals(arg1,arg2) {...
In Symfony it's possible to define multiple routes for one action. This can be very helpful if you have functions that do the same but have different parameters. class TestController extends Controller { /** * @Route("/test1/{id}", name="test") * @Route("/...
We can omit the argument in the call if that argument is an Optional Argument Every Optional Argument has its own default value It will take default value if we do not supply the value A default value of a Optional Argument must be a Constant expression. Must be a value type such as enum or s...
A new pseudo-type dynamic is introduced into the C# type system. It is treated as System.Object, but in addition, any member access (method call, field, property, or indexer access, or a delegate invocation) or application of an operator on a value of such type is permitted without any type checking...
The IQueryable and IQueryable<T> interfaces allows developers to translate a LINQ query (a 'language-integrated' query) to a specific datasource, for example a relational database. Take this LINQ query written in C#: var query = from book in books where book.Author == "Steph...
To create a function which accepts an undetermined number of arguments, there are two methods depending on your environment. 5 Whenever a function is called, it has an Array-like arguments object in its scope, containing all the arguments passed to the function. Indexing into or iterating over th...
Using Code Contracts it is possible to apply a contract to an interface. This is done by declaring an abstract class that implments the interfaces. The interface should be tagged with the ContractClassAttribute and the contract definition (the abstract class) should be tagged with the ContractClas...
Dereferencing happens with the . operator: Object obj = new Object(); String text = obj.toString(); // 'obj' is dereferenced. Dereferencing follows the memory address stored in a reference, to the place in memory where the actual object resides. When an object has been found, the requested meth...
The requests module has top-level functions for most HTTP methods: r = requests.put('https://example.com/', data=put_body) r = requests.delete('https://example.com/') r = requests.head('https://example.com/') r = requests.options('https://example.com/') r = requests.patch('https://example.com/'...
Docker volumes are not automatically removed when a container is stopped. To remove associated volumes when you stop a container: docker rm -v <container id or name> If the -v flag is not specified, the volume remains on-disk as a 'dangling volume'. To delete all dangling volumes: docker ...
Declaration A common misunderstanding, especially beginners, have is read-only property is the one marked with readonly keyword. That's not correct and in fact following is a compile time error: public readonly string SomeProp { get; set; } A property is read-only when it only has a getter. pu...
K&R void* is a catch all type for pointers to object types. An example of this in use is with the malloc function, which is declared as void* malloc(size_t); The pointer-to-void return type means that it is possible to assign the return value from malloc to a pointer to any other type of ob...
With Clipping and Masking you can make some specified parts of elements transparent or opaque. Both can be applied to any HTML element. Clipping Clips are vector paths. Outside of this path the element will be transparent, inside it's opaque. Therefore you can define a clip-path property on elemen...
A declaration introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier. These are declarations: extern int bar; extern int g(int, int); double f(int, double); /* extern can be omitted for f...
import std.stdio; void main() { auto s = "hello world"; auto a = [1, 2, 3, 4]; foreach (c; s) { write(c, "!"); // h!e!l!l!o! !w!o!r!l!d! } writeln(); foreach (x; a) { write(x * x, ", "); // 1, 4, 9, 16, } } ...
In this example will render five <li> tags <ul id="render-sample"> <li v-for="n in 5"> Hello Loop </li> </ul>

Page 127 of 417