View tail.exs
-module(tail). | |
-export([fib/1, perfect/1]). | |
% Functional Programming in Erlang | |
% 1.21 Tail recursion | |
fib(0) -> 0; | |
fib(N) when N > 0 -> fib(N,0,1). | |
% fib(N,0,1) i.e."0,1" | |
% beginning of "0,1,1,2,3,5,..." |
View prac206.erl
-module(prac206). | |
-export([product/1, maximum/1, product1/1, maximum1/1]). | |
product(Xs) -> | |
product(Xs,1). | |
% The product of an empty list is usually taken to be 1: why? | |
% Identity property of Multiplication: | |
% Multiplication of any number with 1 results in the original number |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listing: | |
// 10.1 A React account balances updates every second (p.278) | |
// | |
// $ create-react-app in-the-wild | |
// $ cd in-the-wild | |
// $ npm i -P rxjs | |
// $ npm start |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listing: | |
// 10.1 A React account balances updates every second (p.278) | |
// | |
// Variation B: | |
// - split BalancesView from Balances | |
// - pass BalancesView via render prop |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listing: | |
// 10.2 Communicating to child components using a single parent (p.280) | |
import React, {Component} from 'react'; | |
import PropTypes from 'prop-types'; | |
import ReactDOM from 'react-dom'; | |
import registerServiceWorker from './registerServiceWorker'; |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listings: | |
// 10.3 Simple banking form with checking text field and withdraw button (p.289) | |
// | |
// $ npm i -P redux | |
import React, {Component} from 'react'; | |
import PropTypes from 'prop-types'; |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listing: | |
// 10.3 Simple banking form with checking text field and withdraw button (p.289) | |
// | |
// Variation B: Use Top-level source of truth instead of redux | |
import React, {Component} from 'react'; | |
import PropTypes from 'prop-types'; |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listing: | |
// 10.3 Simple banking form with checking text field and withdraw button (p.289) | |
// | |
// Variation C: Use RxJS for state and use React.Context | |
import React, {Component} from 'react'; | |
import PropTypes from 'prop-types'; |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listings: | |
// 10.7 Implementing custom ofType operator (p.299) | |
// 10.8 Building your middleware (p.299) | |
import Rx from 'rxjs'; | |
import {createStore} from 'redux'; |
View index.js
// file: src/index.js - Derived from: | |
// RxJS in Action (2017, Manning), 978-1-617-29341-2 | |
// by Paul P. Daniels and Luis Atencio | |
// Listings: | |
// 10.6 Plugging into the middleware (p.297) | |
// 10.7 Implementing custom ofType operator (p.299) | |
// 10.8 Building your middleware (p.299) | |
// 10.9 Building the application (p.302) | |
// | |
// $ npm i -P pouchdb-browser |
OlderNewer