Tutorial by Examples

(defun foobar (x y) (format t "X: ~s~@ Y: ~s~%" x y)) (foobar 10 20) ; X: 10 ; Y: 20 ;=> NIL
Optional parameters can be specified after required parameters, by using &OPTIONAL keyword. There may be multiple optional parameters after it. (defun foobar (x y &optional z) (format t "X (~s) and Y (~s) are required.~@ Z (~s) is optional.~%" x y z)) ...
Global named functions are defined with DEFUN. (defun foobar () "Optional documentation string. Can contain line breaks. Must be at the beginning of the function body. Some will format the docstring so that lines are indented to match the first line, although the built-in DESCRIBE-func...
A single rest-parameter can be given with the keyword &REST after the required arguments. If such a parameter exists, the function can take a number of arguments, which will be grouped into a list in the rest-parameter. Note that the variable CALL-ARGUMENTS-LIMIT determines the maximum number of...
The &AUX keyword can be used to define local variables for the function. They are not parameters; the user cannot supply them. &AUX variables are seldomly used. You can always use LET instead, or some other way of defining local variables in the function body. &AUX variables have the a...
Functions always establish a block around the body. This block has the same name as the function name. This means you can use RETURN-FROM with this block name to return from the function and return values. You should avoid returning early whenever possible. (defun foobar (x y) (when (oddp x) ...
Keyword parameters can be defined with the &KEY keyword. They are always optional (see the Optional Parameters example for details of the definition). There may be multiple keyword parameters. (defun foobar (x y &key (z "Default" zp)) (format t "X (~s) and Y (~s) are requi...
Simple split of an IP number string. > (lispworks:split-sequence "." "127.0.0.1") ("127" "0" "0" "1") Simple split of an URL: > (lispworks:split-sequence ".:/" "http://127.0.0.1/foo/bar.html" ...
page = PAGE page.10 = TEXT page.10.value = HELLO WORLD Usually this typoScript snippets are added to Web >> Template >> Info/Modify >> setup This snippet opens a new PAGE object. Inside the PAGE object, the 10th entry is set to be a TEXT object. The value of thus TEXT object ...
The search pattern can also be a regular expression. Running: grep '^[A-Z]' someFile.txt When someFile.txt contains: fred 14 m foo sam 68 m bar christina 83 f baz bob 22 m qux Sam 41 m quux Will produce the output: Sam 41 m quux since this is the only line in someFile.txt starting wi...
Scipy contains parts written in C, C++, and Fortran that need to be compiled before use. Therefore make sure the necessary compilers and Python development headers are installed. Having compiled code also means that Scipy needs additional steps to import from development sources, which are explained...
Move semantics are a way of moving one object to another in C++. For this, we empty the old object and place everything it had in the new object. For this, we must understand what an rvalue reference is. An rvalue reference (T&& where T is the object type) is not much different than a norma...
Say we have this code snippet. class A { public: int a; int b; A(const A &other) { this->a = other.a; this->b = other.b; } }; To create a copy constructor, that is, to make a function that copies an object and creates a new one, we norma...
Similarly to how we can assign a value to an object with an lvalue reference, copying it, we can also move the values from an object to another without constructing a new one. We call this move assignment. We move the values from one object to another existing object. For this, we will have to over...
The normal orElse method takes an Object, so you might wonder why there is an option to provide a Supplier here (the orElseGet method). Consider: String value = "something"; return Optional.ofNullable(value) .orElse(getValueThatIsHardToCalculate()); // returns "some...
A static member function is just like an ordinary C/C++ function, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member function and decorate it correctl...
To access a member function of a class, you need to have a "handle" to the particular instance, as either the instance itself, or a pointer or reference to it. Given a class instance, you can point to various of its members with a pointer-to-member, IF you get the syntax correct! Of course...
To access a member of a class, you need to have a "handle" to the particular instance, as either the instance itself, or a pointer or reference to it. Given a class instance, you can point to various of its members with a pointer-to-member, IF you get the syntax correct! Of course, the poi...
A static member variable is just like an ordinary C/C++ variable, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member variable and decorate it correctl...
sp_who2 This procedure can be used to find information on current SQL server sessions. Since it is a procedure, it's often helpful to store the results into a temporary table or table variable so one can order, filter, and transform the results as needed. The below can be used for a queryable v...

Page 263 of 1336