Tutorial by Examples: f

Functions are only useful if we can call them. To call a function the following syntax is used: print("Hello, World!") We're calling the print function. Using the argument "Hello, World". As is obvious, this will print Hello, World to the output stream. The returned value is ...
Creating anonymous functions Anonymous functions are just like regular Lua functions, except they do not have a name. doThrice(function() print("Hello!") end) As you can see, the function is not assigned to any name like print or add. To create an anonymous function, all you hav...
function sayHello(name) print("Hello, " .. name .. "!") end That function is a simple function, and it works well. But what would happen if we just called sayHello()? stdin:2: attempt to concatenate local 'name' (a nil value) stack traceback: stdin:2: in function ...
Variadic Arguments
function output = mymult(a, b) % MYMULT Multiply two numbers. % output = MYMULT(a, b) multiplies a and b. % % See also fft, foo, sin. % % For more information, see <a href="matlab:web('https://google.com')">Google</a>. output = a * b; end help mymult then p...
git clean -fX Will remove all ignored files from the current directory and all subdirectories. git clean -Xn Will preview all files that will be cleaned.
Implementations in classes, including abstract declarations, take precedence over all interface defaults. Abstract class method takes precedence over Interface Default Method. public interface Swim { default void backStroke() { System.out.println("Swim.backStroke"); ...
Macros return code. Since code in Lisp consists of lists, one can use the regular list manipulation functions to generate it. ;; A pointless macro (defmacro echo (form) (list 'progn (list 'format t "Form: ~a~%" (list 'quote form)) form)) This is often very hard to...
Functions in Common Lisp are first class values. An anonymous function can be created by using lambda. For example, here is a function of 3 arguments which we then call using funcall CL-USER> (lambda (a b c) (+ a (* b c))) #<FUNCTION (LAMBDA (A B C)) {10034F484B}> CL-USER> (defvar *fo...
Any symbol in Common Lisp has a slot for a variable to be bound and a separate slot for a function to be bound. Note that the naming in this example is only for illustration. Global variables should not be named foo, but *foo*. The latter notation is a convention to make it clear that the variable ...
Common Lisp contains many higher order functions which are passed functions for arguments and call them. Perhaps the most fundamental are funcall and apply: CL-USER> (list 1 2 3) (1 2 3) CL-USER> (funcall #'list 1 2 3) (1 2 3) CL-USER> (funcall #'list 1 2 3 4 5) (1 2 3 4 5) CL-USER&g...
os.access is much better solution to check whether directory exists and it's accesable for reading and writing. import os path = "/home/myFiles/directory1" ## Check if path exists os.access(path, os.F_OK) ## Check if path is Readable os.access(path, os.R_OK) ## Check if path i...
Multiple transforms can be applied to an element in one property like this: transform: rotate(15deg) translateX(200px); This will rotate the element 15 degrees clockwise and then translate it 200px to the right. In chained transforms, the coordinate system moves with the element. This means tha...
With Git, you can (almost) always turn the clock back Don't be afraid to experiment with commands that rewrite history*. Git doesn't delete your commits for 90 days by default, and during that time you can easily recover them from the reflog: $ git reset @~3 # go back 3 commits $ git reflog c4...
To refresh the page every five seconds, add this meta element in the head element: <meta http-equiv="refresh" content="5"> CAUTION! While this is a valid command, it is recommended that you do not use it because of its negative effects on user experience. Refreshing the...
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
Firstly, make sure that the agent being used has the following attributes in the Manifest.mf: Can-Redefine-Classes: true Can-Retransform-Classes: true Starting a java agent will let the agent access the class Instrumentation. With Instrumentation you can call addTransformer(ClassFileTransformer...
Flexbox is a layout mode providing for the arrangement of elements on a page such that the elements behave predictably when the page layout must accommodate different screen sizes and different display devices. By default flexbox arranges children in a column. But you can change it to row using flex...
Once setup is completed. Copy the code below to index.android.js or to index.ios.js file to use the props. import React, { Component } from 'react'; import { AppRegistry, Text, View } from 'react-native'; class Greeting extends Component { render() { return ( <Text>Hello {t...
Regular instances require: All instance types must be of the form (T a1 ... an) where a1 ... an are *distinct type variables*, and each type variable appears at most once in the instance head. That means that, for example, while you can create an instance for [a] you can't create an instance f...

Page 51 of 457