Tutorial by Examples: ble

length counts the occurences of elements a in a foldable structure t a. ghci> length [7, 2, 9] -- t ~ [] 3 ghci> length (Right 'a') -- t ~ Either e 1 -- 'Either e a' may contain zero or one 'a' ghci> length (Left "foo") -- t ~ Either String 0 ghci> length (3, True) ...
To instantiate Foldable you need to provide a definition for at least foldMap or foldr. data Tree a = Leaf | Node (Tree a) a (Tree a) instance Foldable Tree where foldMap f Leaf = mempty foldMap f (Node l x r) = foldMap f l `mappend` f x `mappend` foldMap f r fo...
import Data.Traversable as Traversable data MyType a = -- ... instance Traversable MyType where traverse = -- ... Every Traversable structure can be made a Foldable Functor using the fmapDefault and foldMapDefault functions found in Data.Traversable. instance Functor MyType where ...
Implementations of traverse usually look like an implementation of fmap lifted into an Applicative context. data Tree a = Leaf | Node (Tree a) a (Tree a) instance Traversable Tree where traverse f Leaf = pure Leaf traverse f (Node l x r) = Node <$> traverse f l <*...
6 var myIterableObject = {}; // An Iterable object must define a method located at the Symbol.iterator key: myIterableObject[Symbol.iterator] = function () { // The iterator should return an Iterator object return { // The Iterator object must implement a method, next() next: func...
dynamic foo = 123; Console.WriteLine(foo + 234); // 357 Console.WriteLine(foo.ToUpper()) // RuntimeBinderException, since int doesn't have a ToUpper method foo = "123"; Console.WriteLine(foo + 234); // 123234 Console.WriteLine(foo.ToUpper()): // NOW A STRING
toList flattens a Foldable structure t a into a list of as. ghci> toList [7, 2, 9] -- t ~ [] [7, 2, 9] ghci> toList (Right 'a') -- t ~ Either e "a" ghci> toList (Left "foo") -- t ~ Either String [] ghci> toList (3, True) -- t ~ (,) Int [True] toList is ...
Mark your UIView subclass as an accessible element so that it is visible to VoiceOver. myView.isAccessibilityElement = YES; Ensure that the view speaks a meaningful label, value, and hint. Apple provides more details on how to choose good descriptions in the Accessibility Programming Guide.
Chef Scollector Cookbook: https://github.com/alexmbird/chef-scollector Chef Bosun Cookbook: https://github.com/ptqa/chef-bosun Puppet scollector module: https://github.com/axibase/axibase-puppet-modules Bosun Ansible/Vagrant example: https://github.com/gnosek/bosun-deploy
To explicitly declare variables in VBA, use the Dim statement, followed by the variable name and type. If a variable is used without being declared, or if no type is specified, it will be assigned the type Variant. Use the Option Explicit statement on first line of a module to force all variables t...
Use pip to install Flask in a virtualenv. pip install flask Step by step instructions for creating a virtualenv for your project: mkdir project && cd project python3 -m venv env # or `virtualenv env` for Python 2 source env/bin/activate pip install flask Never use sudo pip in...
A Table View is a list of rows that can be selected. Each row is populated from a data source. This example creates a simple table view in which each row is a single line of text. Add a UITableView to your Storyboard Although there are a number of ways to create a UITableView, one of the easiest...
The CREATE TABLE statement is used to create a table in a MySQL database. CREATE TABLE Person ( `PersonID` INTEGER NOT NULL PRIMARY KEY, `LastName` VARCHAR(80), `FirstName` VARCHAR(80), `Address` TEXT, `City` VARCHAR(100) ) Engine=InnoDB; Ev...
CREATE TABLE Person ( PersonID INT UNSIGNED NOT NULL, LastName VARCHAR(66) NOT NULL, FirstName VARCHAR(66), Address VARCHAR(255), City VARCHAR(66), PRIMARY KEY (PersonID) ); A primary key is a NOT NULL single or a multi-column identifier whic...
CREATE TABLE Account ( AccountID INT UNSIGNED NOT NULL, AccountNo INT UNSIGNED NOT NULL, PersonID INT UNSIGNED, PRIMARY KEY (AccountID), FOREIGN KEY (PersonID) REFERENCES Person (PersonID) ) ENGINE=InnoDB; Foreign key: A Foreign Key (FK) is either a single col...
A table can be replicated as follows: CREATE TABLE ClonedPersons LIKE Persons; The new table will have exactly the same structure as the original table, including indexes and column attributes. As well as manually creating a table, it is also possible to create table by selecting data from anot...
Callables are anything which can be called as a callback. Things that can be termed a "callback" are as follows: Anonymous functions Standard PHP functions (note: not language constructs) Static Classes non-static Classes (using an alternate syntax) Specific Object...
The main difference is that double-quoted String literals support string interpolations and the full set of escape sequences. For instance, they can include arbitrary Ruby expressions via interpolation: # Single-quoted strings don't support interpolation puts 'Now is #{Time.now}' # Now is #{Time...
Python 3.x3.0 In Python 3, you can unpack an iterable without knowing the exact number of items in it, and even have a variable hold the end of the iterable. For that, you provide a variable that may collect a list of values. This is done by placing an asterisk before the name. For example, unpacki...
A data.table is an enhanced version of the data.frame class from base R. As such, its class() attribute is the vector "data.table" "data.frame" and functions that work on a data.frame will also work with a data.table. There are many ways to create, load or coerce to a data.table....

Page 5 of 62