Tutorial by Examples: l

You can use the reversed function which returns an iterator to the reversed list: In [3]: rev = reversed(numbers) In [4]: rev Out[4]: [9, 8, 7, 6, 5, 4, 3, 2, 1] Note that the list "numbers" remains unchanged by this operation, and remains in the same order it was originally. To r...
After receiving the arguments, you can print them as follows: int main(int argc, char **argv) { for (int i = 1; i < argc; i++) { printf("Argument %d: [%s]\n", i, argv[i]); } } Notes The argv parameter can be also defined as char *argv[]. argv[0] may co...
Create a receiver. This class will receive the intent and handle it how you wish. public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Handle intent int reqCode = intent.getExtras().getInt(&...
Good for quick notifications that don't require interaction. Swift let alert = UIAlertController(title: "Toast", message: "Hello World", preferredStyle: .Alert) presentViewController(alert, animated: true) { let delay_s:Double = 2 let delayTime = dispatch_time(DI...
The data.table package introduces the function fread. While it is similar to read.table, fread is usually faster and more flexible, guessing the file's delimiter automatically. # get the file path of a CSV included in R's utils package csv_path <- system.file("misc", "exDIF.csv&q...
Create a XIB file Xcode Menu Bar > File > New > File. Select iOS, User Interface and then "View": Give your XIB a name (yes, we are doing a Pokemon example 👾). Remember to check your target and hit "Create". Design your view To make things easier, set:...
There are several R packages to read excel files, each of which using different languages or resources, as summarized in the following table: R packageUsesxlsxJavaXLconnectJavaopenxlsxC++readxlC++RODBCODBCgdataPerl For the packages that use Java or ODBC it is important to know details about your s...
This is a slightly more advanced example that shows a few more features of common lisp. We start with a simple Hello, World! function and demonstrate some interactive development at the REPL. Note that any text from a semicolon, ;, to the rest of the line is a comment. CL-USER> (defun hello () ...
if let Combines a pattern match and an if statement, and allows for brief non-exhaustive matches to be performed. if let Some(x) = option { do_something(x); } This is equivalent to: match option { Some(x) => do_something(x), _ => {}, } These blocks can also have e...
The following types are defined as integral types: char Signed integer types Unsigned integer types char16_t and char32_t bool wchar_t With the exception of sizeof(char) / sizeof(signed char) / sizeof(unsigned char), which is split between § 3.9.1.1 [basic.fundamental/1] and § 5.3.3.1 [ex...
Background threads cannot modify the UI; almost all UIKit methods must be called on the main thread. From a subclass of NSObject (including any UIViewController or UIView): InvokeOnMainThread(() => { // Call UI methods here }); From a standard C# class: UIApplication.SharedApplicat...
A few modules in the standard library have been renamed: Old nameNew name_winregwinregConfigParserconfigparsercopy_regcopyregQueuequeueSocketServersocketserver_markupbasemarkupbasereprreprlibtest.test_supporttest.supportTkintertkintertkFileDialogtkinter.filedialogurllib / urllib2urllib, urllib.pars...
In general, most of the objects you would interact with as a user would tend to be a vector; e.g numeric vector, logical vector. These objects can only take in a single type of variable (a numeric vector can only have numbers inside it). A list would be able to store any type variable in it, making...
2.1.x This example depends on Support Library 23.4.0.+. BottomSheetBehavior is characterized by : Two toolbars with animations that respond to the bottom sheet movements. A FAB that hides when it is near to the "modal toolbar" (the one that appears when you are sliding up). A backdr...
Head over to CMake download page and get a binary for your operating system, e.g. Windows, Linux, or Mac OS X. On Windows double click the binary to install. On Linux run the binary from a terminal. On Linux, you can also install the packages from the distribution's package manager. On Ubuntu 16.0...
LibGDX has a fairly simple setup, with the help of a simple Java program. You can find the download here. When you startup the application, it will look something like this: Note: This screenshot have been taken on Linux and shows path that differs from a Windows installation. However, the form is...
We can repeat an action some number of times using repeat. CL-USER> (loop repeat 10 do (format t "Hello!~%")) Hello! Hello! Hello! Hello! Hello! Hello! Hello! Hello! Hello! Hello! NIL CL-USER> (loop repeat 10 collect (random 50)) (28 46 44 31 5 33 43 35 37 4)
(loop for i in '(one two three four five six) do (print i)) (loop for i in '(one two three four five six) by #'cddr do (print i)) ;prints ONE THREE FIVE (loop for i on '(a b c d e f g) do (print (length i))) ;prints 7 6 5 4 3 2 1 (loop for i on '(a b c d e f g) by #'cddr ...
(defvar *ht* (make-hash-table)) (loop for (sym num) on '(one 1 two 2 three 3 four 4 five 5 six 6 seven 7 eight 8 nine 9 ten 10) by #'cddr do (setf (gethash sym *ht*) num)) (loop for k being each hash-key of *ht* do (print k)) ; iterate over the keys (loop for k ...
Simple LOOP form without special keywords: (loop forms...) To break out of the loop we can use (return <return value>) ` Some examples: (loop (format t "Hello~%")) ; prints "Hello" forever (loop (print (eval (read)))) ; your very own REPL (loop (let ((r (read))) ...

Page 107 of 861