49 results back to index
Clojure Programming by Chas Emerick, Brian Carper, Christophe Grand
Amazon Web Services, Benoit Mandelbrot, cloud computing, cognitive load, continuous integration, database schema, domain-specific language, don't repeat yourself, drop ship, duck typing, en.wikipedia.org, failed state, finite state, Firefox, functional programming, game design, general-purpose programming language, Guido van Rossum, higher-order functions, Larry Wall, mandelbrot fractal, no silver bullet, Paul Graham, platform as a service, premature optimization, random walk, Ruby on Rails, Schrödinger's Cat, semantic web, software as a service, sorting algorithm, SQL injection, Turing complete, type inference, web application
REPL, The Clojure REPL Compojure, Routing Requests with Compojure, Routing Requests with Compojure about, Routing Requests with Compojure routes, Routing Requests with Compojure compositionality, Composition of Function(ality), Building a Primitive Logging System with Composable Higher-Order Functions, Writing Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions building a primitive logging system, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions higher-order functions, Writing Higher-Order Functions concat, unquote and unquote-splicing concurrency and parallelism, Why Clojure?
…
compositionality, Composition of Function(ality), Building a Primitive Logging System with Composable Higher-Order Functions, Writing Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions building a primitive logging system, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions higher-order functions, Writing Higher-Order Functions first-class and higher-order functions, First-Class and Higher-Order Functions, Applying Ourselves Partially pure functions, Pure Functions values, On the Importance of Values, A Critical Choice, About Values, Comparing Values to Mutable Objects, Comparing Values to Mutable Objects, A Critical Choice about, About Values comparing to mutable objects, Comparing Values to Mutable Objects, Comparing Values to Mutable Objects unfettered object state, A Critical Choice frequencies, Use Primitive Arrays Judiciously function application, Applying Ourselves Partially, Applying Ourselves Partially function composition, Composition of Function(ality) function literals, First-Class and Higher-Order Functions, Applying Ourselves Partially versus anonymous functions, First-Class and Higher-Order Functions versus partial literals, Applying Ourselves Partially functions, Special Forms, Destructuring (let, Part 2), Sequential destructuring, Creating Functions: fn, Function literals, Creating Functions: fn, Creating Functions: fn, Creating Functions: fn, Creating Functions: fn, Destructuring function arguments, Function literals, Function literals, Functional Programming, Comparing Values to Mutable Objects, First-Class and Higher-Order Functions, Applying Ourselves Partially, First-Class and Higher-Order Functions, First-Class and Higher-Order Functions, Pure Functions, Pure Functions, Why Are Pure Functions Interesting?
…
, On the Importance of Values, A Critical Choice, About Values, Comparing Values to Mutable Objects, Comparing Values to Mutable Objects, A Critical Choice, First-Class and Higher-Order Functions, Applying Ourselves Partially, Composition of Function(ality), Building a Primitive Logging System with Composable Higher-Order Functions, Writing Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions, Pure Functions about, What Does Functional Programming Mean? compositionality, Composition of Function(ality), Building a Primitive Logging System with Composable Higher-Order Functions, Writing Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions building a primitive logging system, Building a Primitive Logging System with Composable Higher-Order Functions, Building a Primitive Logging System with Composable Higher-Order Functions higher-order functions, Writing Higher-Order Functions first-class and higher-order functions, First-Class and Higher-Order Functions, Applying Ourselves Partially pure functions, Pure Functions values, On the Importance of Values, A Critical Choice, About Values, Comparing Values to Mutable Objects, Comparing Values to Mutable Objects, A Critical Choice about, About Values comparing to mutable objects, Comparing Values to Mutable Objects, Comparing Values to Mutable Objects unfettered object state, A Critical Choice frequencies, Use Primitive Arrays Judiciously function application, Applying Ourselves Partially, Applying Ourselves Partially function composition, Composition of Function(ality) function literals, First-Class and Higher-Order Functions, Applying Ourselves Partially versus anonymous functions, First-Class and Higher-Order Functions versus partial literals, Applying Ourselves Partially functions, Special Forms, Destructuring (let, Part 2), Sequential destructuring, Creating Functions: fn, Function literals, Creating Functions: fn, Creating Functions: fn, Creating Functions: fn, Creating Functions: fn, Destructuring function arguments, Function literals, Function literals, Functional Programming, Comparing Values to Mutable Objects, First-Class and Higher-Order Functions, Applying Ourselves Partially, First-Class and Higher-Order Functions, First-Class and Higher-Order Functions, Pure Functions, Pure Functions, Why Are Pure Functions Interesting?
Programming in Haskell by Graham Hutton
Eratosthenes, functional programming, higher-order functions, John Conway, Simon Singh, type inference
Many computations have a simple and natural definition in terms of recursive functions, particularly when “pattern matching” and “guards” are used to separate different cases into different equations. r Higher-order functions (chapter 7) Haskell is a higher-order functional language, which means that functions can freely take functions as arguments and produce functions as results. Using higher-order functions allows common programming patterns, such as composing two functions, to be defined as functions within the language itself. More generally, higher-order functions can be used to define “domainspecific languages” within Haskell, such as for list processing, parsing, and interactive programming. r Monadic effects (chapters 8 and 9) Functions in Haskell are pure functions that take all their input as arguments and produce all their output as results.
…
Using the five-step process, define the library functions that calculate the sum of a list of numbers, take a given number of elements from the start of a list, and select the last element of a non-empty list. chapter 7 Higher-order functions In this chapter we introduce higher-order functions, which allow common programming patterns to be encapsulated as functions. We start by explaining what higher-order functions are and why they are useful, then introduce a number of standard higher-order functions for processing lists, consider function composition, and conclude by developing a string transmitter. 7.1 Basic concepts As we have seen in previous chapters, functions with multiple arguments are usually defined in Haskell using the notion of currying.
…
Using the higher-order functions map and composition, this conversion can be implemented as follows: encode :: String → [Bit ] encode = concat ◦ map (make8 ◦ int2bin ◦ ord ) For example: > encode "abc" [1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0] To decode a list of bits produced using encode , we first define a function chop8 that chops such a list up into eight-bit binary numbers: chop8 :: [Bit ] → [[Bit ]] chop8 [ ] = [] chop8 bits = take 8 bits : chop8 (drop 8 bits) 71 72 HIGHER-ORDER FUNCTIONS It is now easy to define a function that decodes a list of bits as a string of characters by chopping the list up, and converting each resulting binary number into a Unicode number and then a character: decode :: [Bit ] → String decode = map (chr ◦ bin2int) ◦ chop8 For example: > decode [1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0] "abc" Finally, we define a function transmit that simulates the transmission of a string of characters as a list of bits, using a perfect communication channel that we model using the identity function: transmit :: String → String transmit = decode ◦ channel ◦ encode channel channel :: [Bit ] → [Bit ] = id For example: > transmit "higher-order functions are easy" "higher-order functions are easy" 7.7 Chapter remarks Further applications of higher-order functions, including the production of computer music, financial contracts, graphical images, hardware descriptions, logic programs, and pretty printers can be found in The Fun of Programming (7). A more in-depth tutorial on foldr is given in (14). 7.8 Exercises 1. Show how the list comprehension [ f x | x ← xs , p x ] can be re-expressed using the higher-order functions map and filter . 2. Without looking at the definitions from the standard prelude, define the higher-order functions all , any , takeWhile , and dropWhile . 3.
Programming in Haskell by Graham Hutton
domain-specific language, Eratosthenes, first-past-the-post, functional programming, higher-order functions, type inference
But as we shall see, many computations have a simple and natural definition in terms of recursive functions, especially when pattern matching and guards are used to separate different cases into different equations. Higher-order functions (chapter 7) Haskell is a higher-order functional language, which means that functions can freely take functions as arguments and produce functions as results. Using higher-order functions allows common programming patterns, such as composing two functions, to be defined as functions within the language itself. More generally, higher-order functions can be used to define domain-specific languages within Haskell itself, such as for list processing, interactive programming, and parsing.
…
Hint: first define a function halve :: [a] -> ([a],[a]) that splits a list into two halves whose lengths differ by at most one. 9.Using the five-step process, construct the library functions that: a.calculate the sum of a list of numbers; b.take a given number of elements from the start of a list; c.select the last element of a non-empty list. Solutions to exercises 1–4 are given in appendix A. 7 Higher-order functions In this chapter we introduce higher-order functions, which allow common programming patterns to be encapsulated as functions. We start by explaining what higher-order functions are and why they are useful, then introduce a number of higher-order functions from the standard prelude, and conclude by implementing a binary string transmitter and two voting algorithms. 7.1Basic concepts As we have seen in previous chapters, functions with multiple arguments are usually defined in Haskell using the notion of currying.
…
Formally speaking, a function that takes a function as an argument or returns a function as a result is called a higher-order function. In practice, however, because the term curried already exists for returning functions as results, the term higher-order is often just used for taking functions as arguments. It is this latter interpretation that is the subject of this chapter. Using higher-order functions considerably increases the power of Haskell, by allowing common programming patterns to be encapsulated as functions within the language itself. More generally, higher-order functions can be used to define domain-specific languages within Haskell.
Introducing Elixir by Simon St.Laurent, J. David Eisenberg
Debian, finite state, functional programming, higher-order functions, Pluto: dwarf planet, Ruby on Rails, web application
Since Valid is a proto‐ col rather than a module, we have to compile the file: iex(12)> c("lib/valid.ex") warning: redefining module Valid (current version loaded from _build/dev/consolidated/Elixir.Valid.beam) lib/valid.ex:1 [Valid] iex(13)> inspect t3 "241m: Woolworth Building, NYC, earth" From Maps to Structs | 91 CHAPTER 8 Higher-Order Functions and List Comprehensions Higher-order functions, or functions that accept other functions as arguments, are a key place where Elixir’s power really starts to shine. It’s not that you can’t do higherorder functions in other languages—you can in many—but rather that Elixir treats higher-order functions as a native and natural part of the language rather than an oddity. Simple Higher-Order Functions Way back in Chapter 2, you saw how to use fn to create a function: iex(1)> fall_velocity = fn(distance) -> :math.sqrt(2 * 9.8 * distance) end #Function<6.106461118/1 in :erl_eval.expr/5> iex(2)> fall_velocity.(20) 19.79898987322333 iex(3)> fall_velocity.(200) 62.609903369994115 Elixir not only lets you put functions into variables, it lets you pass functions as argu‐ ments.
…
Name-Value Pairs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Keyword Lists iv | Table of Contents 79 Lists of Tuples with Multiple Keys Hash Dictionaries From Lists to Maps Creating Maps Updating Maps Reading Maps From Maps to Structs Setting Up Structs Creating and Reading Structs Pattern Matching Against Structs Using Structs in Functions Adding Behavior to Structs Adding to Existing Protocols 81 82 83 83 84 84 84 85 85 86 86 89 90 8. Higher-Order Functions and List Comprehensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Simple Higher-Order Functions Creating New Lists with Higher-Order Functions Reporting on a List Running List Values Through a Function Filtering List Values Beyond List Comprehensions Testing Lists Splitting Lists Folding Lists 93 95 96 96 97 98 98 99 100 9. Playing with Processes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 The Shell Is a Process Spawning Processes from Modules Lightweight Processes Registering a Process When Processes Break Processes Talking Amongst Themselves Watching Your Processes Watching Messages Among Processes Breaking Things and Linking Processes 103 105 108 109 110 111 114 115 117 10.
…
Again, you can use the ampersand notation: iex(11)> x = 20 20 iex(12)> my_function3 = &(x * &1) #Function<6.106461118/1 in :erl_eval.expr/5> iex(13)> x = 0 0 iex(14)> Hof.tripler(6, my_function3) 360 You may also want to pass a function from a module, even a built-in module, to your (or any) higher-order function. That’s simple, too: iex(15)> Hof.tripler(:math.pi, &:math.cos(&1)) -3.0 In this case, the Hof.tripler function receives the value pi and a function, which is the :math.cos/1 function from the built-in math module. Since the function has arity 1, you must indicate this with &1. Because the cosine of pi is –1, the tripler returns -3.0. Creating New Lists with Higher-Order Functions Lists are one of the best and easiest places to apply higher-order functions. Applying a function to all the components of a list to create a new list, sort a list, or break a list into smaller pieces is popular work.
Scala in Action by Nilanjan Raychaudhuri
business logic, continuous integration, create, read, update, delete, database schema, domain-specific language, don't repeat yourself, duck typing, en.wikipedia.org, failed state, fault tolerance, functional programming, general-purpose programming language, higher-order functions, index card, Kanban, MVC pattern, type inference, web application
The following code creates a function version of the use method from the previous example: val use_func: Resource => Boolean = (new UseResource).use _ It’s common in Scala to convert methods into functions and pass them around to other functions. In the next section you’ll look into examples of higher-order functions and how they help you in solving problems. 5.3.2. Higher-order functions Higher-order functions are those that take functions as parameters or return functions as a return value. You’ve already seen plenty of examples of higher-order functions throughout the book. In the Scala collections you’ll notice the use of higher-order functions everywhere. For example, to filter out all the even numbers from a List, you write something like the following: scala> val l = List(1, 2, 3, 5, 7, 10, 15) l: List[Int] = List(1, 2, 3, 5, 7, 10, 15) scala> l.filter(_ % 2 == 0) res0: List[Int] = List(2, 10) Here % 2 == 0 is a function literal (I’m sure you already knew that).
…
Take a look at the Strategy pattern.[6] This pattern allows you to select algorithms at runtime and can easily be implemented using a higher-order function: 6 “Strategy pattern,” February 2011, http://en.wikipedia.org/wiki/Strategy_pattern. def calculatePrice(product: String, taxingStrategy: String => Double) = { ... ... val tax = taxingStrategy(product) ... } Because taxingStrategy is defined as a function, you can pass different implementations of the strategy. Similarly you can also implement the template method pattern using the higher-order functions. Higher-order functions are also useful when dealing with dependency injection (DI). You can use function currying to inject dependencies.
…
In chapter 4 you’ll learn Scala collections, which broadly support two categories of data structures—immutable and mutable. To understand and benefit from Scala collections, you need to know two concepts: type parameterization and higher-order functions. Type parameterization allows you to create types that take another type as a parameter (similar to Java generics). Higher-order functions let you create functions that take other functions as parameters. These two concepts allow you to create generic and reusable components, like Scala collections. The Scala collection is one of Scala’s most powerful features.
The TypeScript Workshop: A Practical Guide to Confident, Effective TypeScript Programming by Ben Grynhaus, Jordan Hudgens, Rayon Hunte, Matthew Thomas Morgan, Wekoslav Stefanovski
Ada Lovelace, Albert Einstein, business logic, Charles Babbage, create, read, update, delete, don't repeat yourself, Donald Knuth, fault tolerance, Firefox, full stack developer, functional programming, Google Chrome, Hacker News, higher-order functions, inventory management, Kickstarter, loose coupling, node package manager, performance metric, QR code, Ruby on Rails, SQL injection, type inference, web application, WebSocket
We also tested the skills developed in the chapter by creating a movie data viewer browser, first using XHR and callbacks, and then improved it progressively using fetch and promises, and then using fetch and async/await. The next chapter will teach you about higher-order functions and callbacks. 11. Higher-Order Functions and Callbacks Overview This chapter introduces higher-order functions and callbacks in TypeScript. You will first understand what higher-order functions are, why they are useful, and how to type them correctly in TypeScript. Then, the chapter will teach you about what callbacks are, why they are used, and in what situations. You will also learn about why callbacks are so widely used, especially in Node.js.
…
Exercise 10.04: Counting to Five with Promises Activity 10.02: Movie Browser Using fetch and Promises async/await Exercise 10.05: Counting to Five with async and await Activity 10.03: Movie Browser Using fetch and async/await Summary 11. Higher-Order Functions and Callbacks Introduction Introduction to HOCs – Examples Higher-Order Functions Exercise 11.01: Orchestrating Data Filtering and Manipulation Using Higher-Order Functions Callbacks The Event Loop Callbacks in Node.js Callback Hell Avoiding Callback Hell Splitting the Callback Handlers into Function Declarations at the File Level Chaining Callbacks Promises async/await Activity 11.01: Higher-Order Pipe Function Summary 12.
…
The preceding code could be rewritten in a longer form: Example_Currying_3.ts 1 const addTwoNumbers = (a: number): ((b: number) => number) => { 2 return (b: number): number => { 3 return a + b; 4 } 5 } 6 7 const addFunction = addTwoNumbers(3); 8 9 console.log(addFunction(4)); Link to the preceding example: https://packt.link/TgC17 The output is as follows: 7 It looks a bit silly when written that way, but these do exactly the same thing. So what use is currying? Higher-order functions are a variety of curried functions. Higher-order functions both take a function as an argument and return a new function. These functions are often wrapping or modifying some existing functionality. How can we wrap our REST client in a higher-order function to ensure that all responses, whether successful or in error, are handled in a uniform way? This will be the focus of the next exercise. Exercise 3.06: Refactoring into Curried Functions Currying makes use of closures and is closely related to the last exercise, so let's return to it and establish the solution from the last exercise as the starting point for this one.
Functional Programming in Scala by Paul Chiusano, Rúnar Bjarnason
domain-specific language, functional programming, higher-order functions, iterative process, loose coupling, off-by-one error, type inference, web application
As with learning a foreign language, immersion is a very effective method, so we will start by looking at a small but complete Scala program. If you have no experience with Scala, you should not expect to understand the code at first glance. Therefore we will break it down piece by piece to look at what it does. We will then look at working with higher-order functions. These are functions that take other functions as arguments, and may themselves return functions as their output. This can be brain-bending if you have a lot of experience programming in a language without the ability to pass functions around like that. Remember, it's not crucial that you internalize every single concept in this chapter, or solve every exercise.
…
To declare a function with multiple arguments, we just separate each argument by a comma. Second, our formatResult function now takes another function, which we call f (this is a common naming convention in FP; see the sidebar below). A function that takes another function as an argument is called a higher-order function (HOF). Like any other function parameter, we give a type to f, the type Int => Int, which indicates that f expects an Int and will also return an Int. (The type of a function expecting an Int and a String and returning an Int would be written as (Int,String) => Int.) Next, notice that we call the function f using the same syntax as when we called abs(x) or factorial(n) directly.
…
We will often use "function" to refer to either such a first-class function or a method, depending on context. www.it-ebooks.info 27 2.6 Polymorphic functions: abstracting over types So far we have been defining only monomorphic functions. That is, functions that operate on only one type of data. For example, abs, and factorial are specific to arguments of type Int, and the higher-order function formatResult is also fixed to operate on functions that take arguments of type Int. Very often, we want to write code which works for any type it is given. As an example, here's a definition of binary search, specialized for searching for a Double in an Array[Double]. Double is another primitive type in Scala, representing double precision floating point numbers.
Erlang Programming by Francesco Cesarini
cloud computing, fault tolerance, finite state, functional programming, higher-order functions, loose coupling, revision control, RFC: Request For Comment, social bookmarking, sorting algorithm, Turing test, type inference, web application
‡ The only way in practice to get two references that are the same would be to save a reference in a file of Erlang terms, stop the node, and then reload the reference from the file after restarting the node; a reference created in the newly restarted node might then be equal to the saved value, since for each incarnation of the node, references are allocated to be integers starting at 0. 210 | Chapter 9: More Data Types and High-Level Constructs Exercises Exercise 9-1: Higher-Order Functions Using funs and higher-order functions, write a function that prints out the integers between 1 and N. Hint: use lists:seq(1, N). Using funs and higher-order functions, write a function that, given a list of integers and an integer, will return all integers smaller than or equal to that integer. Using funs and higher-order functions, write a function that prints out the even integers between 1 and N. Hint: solve your problem in two steps, or use two clauses in your fun. Using funs and higher-order functions, write a function that, given a list of lists, will concatenate them.
…
Predefined, Higher-Order Functions The lists module contains a collection of higher-order functions—that is, functions that take funs as arguments and apply them to a list. These higher-order functions allow you to hide the recursive pattern in the function call to the lists module while isolating all side effects and operations on the list elements in a fun. The following list contains * The phrase syntactic sugar was invented by Peter Landin, and is used for shorthand notations that make a language “sweeter to use,” but don’t add to its expressiveness. Funs and Higher-Order Functions | 195 the most common recursive patterns defined in the higher-order functions of the lists module: all(Predicate, List) Returns true if the Predicate—which is a fun that returns a Boolean value when it is applied to one of the list elements—returns true for all the elements in the list, and returns false otherwise. any(Predicate, List) Returns true if the Predicate returns true for any element in the list, and returns false otherwise. dropwhile(Predicate, List) Drops the head of the list and recurses on the tail for as long as Predicate returns true. filter(Predicate, List) Removes all elements in the list for which Predicate is false, returning the list of remaining elements. foldl(Fun, Accumulator, List) Takes a two-argument function, Fun.
…
Software Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Upgrading Modules Behind the Scenes Loading Code The Code Server Purging Modules Upgrading Processes The .erlang File Exercise 173 176 179 180 182 182 186 186 9. More Data Types and High-Level Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Functional Programming for Real Funs and Higher-Order Functions Functions As Arguments Writing Down Functions: fun Expressions Functions As Results Using Already Defined Functions Functions and Variables Predefined, Higher-Order Functions Lazy Evaluation and Lists List Comprehensions A First Example General List Comprehensions Multiple Generators Standard Functions Binaries and Serialization Binaries The Bit Syntax Pattern-Matching Bits Bitstring Comprehensions Bit Syntax Example: Decoding TCP Segments Bitwise Operators Serialization References vi | Table of Contents 189 190 190 192 193 194 195 195 197 198 198 198 200 200 201 202 203 205 206 206 208 208 210 Exercises 211 10.
The Joy of Clojure by Michael Fogus, Chris Houser
cloud computing, Dennis Ritchie, domain-specific language, Donald Knuth, Douglas Hofstadter, duck typing, en.wikipedia.org, finite state, functional programming, Gödel, Escher, Bach, haute couture, higher-order functions, Larry Wall, Paul Graham, rolodex, SQL injection, traveling salesman
. ; actual: java.lang.AssertionError: ; Assert failed: (= (join "," [1 2 3]) "1,3,3") ; ... As expected, the faulty unit test for join failed. Unit tests in Clojure only scratch the surface of the boundless spectrum of examples using functions as data, but for now they’ll do, as we move into the notion of higher-order functions. 7.1.2. Higher-order functions A higher-order function is a function that does at least one of the following: Takes one or more functions as arguments Returns a function as a result A Java programmer might be familiar with the practices of subscriber patterns or schemes using more general-purpose callback objects.
…
Building your programs using first-class functions in concert with higher-order functions will reduce complexities and make your codebase more robust and extensible. In the next subsection, we’ll explore pure functions, which all prior functions in this section have been, and explain why your own applications should strive toward purity. Prefer higher-order functions when processing sequences We mentioned in section 6.3 that one way to ensure that lazy sequences are never fully realized in memory is to prefer (Hutton 1999) higher-order functions for processing. Most collection processing can be performed with some combination of the following functions: map, reduce, filter, for, some, repeatedly, sort-by, keep take-while, and drop-while But higher-order functions aren’t a panacea for every solution.
…
Most collection processing can be performed with some combination of the following functions: map, reduce, filter, for, some, repeatedly, sort-by, keep take-while, and drop-while But higher-order functions aren’t a panacea for every solution. Therefore, we’ll cover the topic of recursive solutions deeper in section 7.3 for those cases when higher-order functions fail or are less than clear. 7.1.3. Pure functions Simply put, pure functions are regular functions that, through convention, conform to the following simple guidelines: The function always returns the same result, given some expected arguments. The function doesn’t cause any observable side-effects.
Learn You a Haskell for Great Good!: A Beginner's Guide by Miran Lipovaca
fault tolerance, functional programming, higher-order functions, loose coupling, type inference
compiling, Separating the Pure from the Impure defining main, Separating the Pure from the Impure function types, Hello, World! printed output, Hello, World! running, Hello, World! hierarchical modules, Enter Data.Map higher-order functions. See also functions, Higher-Order Functions, Higher-Order Functions, Some Higher-Orderism Is in Order, Implementing zipWith, Implementing zipWith, The map Function curried functions, Higher-Order Functions flip, Implementing zipWith map, The map Function type declaration, Some Higher-Orderism Is in Order zipWith, Implementing zipWith Hoogle search engine, Modules I I/O (input and output), More Input and More Output, Reading and Writing Files, Using the withFile Function, It's Bracket Time, It's Bracket Time, Grab the Handles!
…
If you’ve correctly chosen the base cases and subproblems, you don’t even have to think about the details of how everything will happen. You can just trust that the solutions of the subproblems are correct, and then you can just build up your final solutions from those smaller solutions. Chapter 5. Higher-Order Functions Haskell functions can take functions as parameters and return functions as return values. A function that does either of these things is called a higher-order function. Higher-order functions are a really powerful way of solving problems and thinking about programs, and they’re indispensable when using a functional programming language like Haskell. Curried Functions Every function in Haskell officially takes only one parameter.
…
The first list must be a list of type a values, because the joining function takes a types as its first argument. The second must be a list of b types, because the second parameter of the joining function is of type b. The result is a list of type c elements. Note Remember that if you’re writing a function (especially a higher-order function), and you’re unsure of the type, you can try omitting the type declaration and checking what Haskell infers it to be by using :t. This function is similar to the normal zip function. The base cases are the same, although there’s an extra argument (the joining function). However, that argument doesn’t matter in the base cases, so we can just use the _ character for it.
Eloquent JavaScript: A Modern Introduction to Programming by Marijn Haverbeke
always be closing, Charles Babbage, domain-specific language, Donald Knuth, en.wikipedia.org, Firefox, fizzbuzz, functional programming, higher-order functions, hypertext link, job satisfaction, MITM: man-in-the-middle, premature optimization, slashdot, web application, WebSocket
In cases like this example, where the body is a single small expression, you could also omit the braces and write the loop on a single line. Higher-Order Functions Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions. Since we have already seen that functions are regular values, there is nothing particularly remarkable about the fact that such functions exist. The term comes from mathematics, where the distinction between functions and other values is taken more seriously. Higher-order functions allow us to abstract over actions, not just values. They come in several forms.
…
Code, and What to Do with It Overview of This Book Typographic Conventions PART I: LANGUAGE 1 VALUES, TYPES, AND OPERATORS Values Numbers Arithmetic Special Numbers Strings Unary Operators Boolean Values Comparison Logical Operators Empty Values Automatic Type Conversion Short-Circuiting of Logical Operators Summary 2 PROGRAM STRUCTURE Expressions and Statements Bindings Binding Names The Environment Functions The console.log Function Return Values Control Flow Conditional Execution while and do Loops Indenting Code for Loops Breaking Out of a Loop Updating Bindings Succinctly Dispatching on a Value with switch Capitalization Comments Summary Exercises Looping a Triangle FizzBuzz Chessboard 3 FUNCTIONS Defining a Function Bindings and Scopes Nested Scope Functions as Values Declaration Notation Arrow Functions The Call Stack Optional Arguments Closure Recursion Growing Functions Functions and Side Effects Summary Exercises Minimum Recursion Bean Counting 4 DATA STRUCTURES: OBJECTS AND ARRAYS The Weresquirrel Data Sets Properties Methods Objects Mutability The Lycanthrope’s Log Computing Correlation Array Loops The Final Analysis Further Arrayology Strings and Their Properties Rest Parameters The Math Object Destructuring JSON Summary Exercises The Sum of a Range Reversing an Array A List Deep Comparison 5 HIGHER-ORDER FUNCTIONS Abstraction Abstracting Repetition Higher-Order Functions Script Data Set Filtering Arrays Transforming with map Summarizing with reduce Composability Strings and Character Codes Recognizing Text Summary Exercises Flattening Your Own Loop Everything Dominant Writing Direction 6 THE SECRET LIFE OF OBJECTS Encapsulation Methods Prototypes Classes Class Notation Overriding Derived Properties Maps Polymorphism Symbols The Iterator Interface Getters, Setters, and Statics Inheritance The instanceof Operator Summary Exercises A Vector Type Groups Iterable Groups Borrowing a Method 7 PROJECT: A ROBOT Meadowfield The Task Persistent Data Simulation The Mail Truck’s Route Pathfinding Exercises Measuring a Robot Robot Efficiency Persistent Group 8 BUGS AND ERRORS Language Strict Mode Types Testing Debugging Error Propagation Exceptions Cleaning Up After Exceptions Selective Catching Assertions Summary Exercises Retry The Locked Box 9 REGULAR EXPRESSIONS Creating a Regular Expression Testing for Matches Sets of Characters Repeating Parts of a Pattern Grouping Subexpressions Matches and Groups The Date Class Word and String Boundaries Choice Patterns The Mechanics of Matching Backtracking The replace Method Greed Dynamically Creating RegExp Objects The search Method The lastIndex Property Looping Over Matches Parsing an INI File International Characters Summary Exercises Regexp Golf Quoting Style Numbers Again 10 MODULES Modules as Building Blocks Packages Improvised Modules Evaluating Data as Code CommonJS ECMAScript Modules Building and Bundling Module Design Summary Exercises A Modular Robot Roads Module Circular Dependencies 11 ASYNCHRONOUS PROGRAMMING Asynchronicity Crow Tech Callbacks Promises Failure Networks Are Hard Collections of Promises Network Flooding Message Routing Async Functions Generators The Event Loop Asynchronous Bugs Summary Exercises Tracking the Scalpel Building Promise.all 12 PROJECT: A PROGRAMMING LANGUAGE Parsing The Evaluator Special Forms The Environment Functions Compilation Cheating Exercises Arrays Closure Comments Fixing Scope PART II: BROWSER 13 JAVASCRIPT AND THE BROWSER Networks and the Internet The Web HTML HTML and JavaScript In the Sandbox Compatibility and the Browser Wars 14 THE DOCUMENT OBJECT MODEL Document Structure Trees The Standard Moving Through the Tree Finding Elements Changing the Document Creating Nodes Attributes Layout Styling Cascading Styles Query Selectors Positioning and Animating Summary Exercises Build a Table Elements by Tag Name The Cat’s Hat 15 HANDLING EVENTS Event Handlers Events and DOM Nodes Event Objects Propagation Default Actions Key Events Pointer Events Mouse Clicks Mouse Motion Touch Events Scroll Events Focus Events Load Event Events and the Event Loop Timers Debouncing Summary Exercises Balloon Mouse Trail Tabs 16 PROJECT: A PLATFORM GAME The Game The Technology Levels Reading a Level Actors Encapsulation as a Burden Drawing Motion and Collision Actor Updates Tracking Keys Running the Game Exercises Game Over Pausing the Game A Monster 17 DRAWING ON CANVAS SVG The Canvas Element Lines and Surfaces Paths Curves Drawing a Pie Chart Text Images Transformation Storing and Clearing Transformations Back to the Game Choosing a Graphics Interface Summary Exercises Shapes The Pie Chart A Bouncing Ball Precomputed Mirroring 18 HTTP AND FORMS The Protocol Browsers and HTTP Fetch HTTP Sandboxing Appreciating HTTP Security and HTTPS Form Fields Focus Disabled Fields The Form as a Whole Text Fields Checkboxes and Radio Buttons Select Fields File Fields Storing Data Client-Side Summary Exercises Content Negotiation A JavaScript Workbench Conway’s Game of Life 19 PROJECT: A PIXEL ART EDITOR Components The State DOM Building The Canvas The Application Drawing Tools Saving and Loading Undo History Let’s Draw Why Is This So Hard?
…
function unless(test, then) { if (!test) then(); } repeat(3, n => { unless(n % 2 == 1, () => { console.log(n, "is even"); }); }); // → 0 is even // → 2 is even There is a built-in array method, forEach, that provides something like a for/of loop as a higher-order function. ["A", "B"].forEach(l => console.log(l)); // → A // → B Script Data Set One area where higher-order functions shine is data processing. To process data, we’ll need some actual data. This chapter will use a data set about scripts—writing systems such as Latin, Cyrillic, or Arabic. Remember Unicode from Chapter 1, the system that assigns a number to each character in written language?
Pragmatic.Programming.Erlang.Jul.2007 by Unknown
Debian, en.wikipedia.org, fault tolerance, finite state, full text search, functional programming, higher-order functions, Planet Labs, RFC: Request For Comment
Among other things this means that funs can be used as the arguments to functions and that functions (or funs) can return funs. Functions that return funs, or functions that can accept funs as their arguments, are called higher-order functions. We’ll see a few examples of these in the next sections. Now all of this might not sound very exciting since we haven’t seen what we can do with funs. So far, the code in a fun looks just like regular function code in a module, but nothing could be further from the truth. Higher-order functions are the very essence of functional programming languages—they breathe fire into the belly of the code. Once you’ve learned to use them, you’ll love them.
…
If we call for(1,10,F), the first clause cannot match since Max cannot match both 1 and 10 at the same time. In this case, the second clause matches with bindings I 7→ 1 and Max 7→ 10; the value of the function is then [F(I)|for(I+1,10,F)] with I substituted by 1 and Max substituted by 10, which is just[F(1)|for(2,10,F)]. 56 F UNS When Do We Use Higher-Order Functions? As we have seen, when we use higher-order functions, we can create our own new control abstractions, we can pass functions as arguments, and we can write functions that return funs. In practice, not all these techniques get used often: • Virtually all the modules that I write use functions like lists:map/2—this is so common that I almost consider map to be part of the Erlang language.
…
We talk about the techniques for ensuring that an Erlang program will run efficiently on multicore computers. We introduce a number of abstractions for speeding up sequential programs on multicore computers. Finally we perform some measurements and develop our third major program, a full-text search engine. To write this, we first implement a function called mapreduce—this is a higher-order function for parallelizing a computation over a set of processing elements. • Appendix A, on page 390, describes the type system used to document Erlang functions. • Appendix B, on page 396, describes how to set up Erlang on the Windows operating system (and how to configure emacs on all operating systems). • Appendix C, on page 399, has a catalog of Erlang resources. • Appendix D, on page 403, describes lib_chan, which is a library for programming socket-based distribution. 15 B EGIN A GAIN • Appendix E, on page 419, looks at techniques for analyzing, profiling, debugging, and tracing your code. • Appendix F, on page 439, has one-line summaries of the most used modules in the Erlang standard libraries. 1.2 Begin Again Once upon a time a programmer came across a book describing a funny programming language.
Elixir in Action by Saša Jurić
demand response, en.wikipedia.org, fail fast, fault tolerance, finite state, functional programming, general-purpose programming language, higher-order functions, place-making, reproducible builds, Ruby on Rails, WebSocket
Recursion is the basic looping technique, and no loop can be done without it. Still, you won’t need to write explicit recursion all that often. Many typical tasks can be performed by using higher-order functions. 3.4.3 Higher-order functions A higher-order function is a fancy name for a function that takes one or more functions as its input or returns one or more functions (or both). The word function here means “function value.” You already made first contact with higher-order functions in chapter 2, when you used Enum.each/2 to iterate through a list and print all of its elements. Let’s recall how to do this: iex(1)> Enum.each( [1, 2, 3], fn x -> IO.puts(x) end ) 1 2 3 Passing a function value to another function The function Enum.each/2 takes an enumerable (in this case, a list), and a lambda.
…
It iterates through the enumerable, calling the lambda for each of its elements. Because Enum.each/2 takes a lambda as its input, it’s called a higher-order function. You can use Enum.each/2 to iterate over enumerable structures without writing the recursion. Under the hood, Enum.each/2 is powered by recursion: there’s no other way to do loops and iterations in Elixir. But the complexity of writing the recursion, the repetitive code, and the intricacies of tail recursion are hidden from you. 92 Chapter 3 Control flow Enum.each/2 is just one example of an iteration powered by a higher-order function. Elixir’s standard library provides many other useful iteration helpers in the Enum module.
…
Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 ISBN 9781617295027 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – SP – 23 Development editor: Review editor: Project manager: Copy editor: Proofreader: Technical proofreader: Typesetter: Cover designer: 22 21 20 19 18 Karen Miller Aleksandar Dragosavljevic Vincent Nordhaus Andy Carrol Melody Dolab Riza Fahmi Happenstance Type-O-Rama Marija Tudor brief contents 1 2 3 4 5 6 7 8 9 10 11 12 13 ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ First steps 1 Building blocks 16 Control flow 63 Data abstractions 102 Concurrency primitives 129 Generic server processes 159 Building a concurrent system 179 Fault-tolerance basics 201 Isolating error effects 224 Beyond GenServer 251 Working with components 277 Building a distributed system 305 Running the system 334 v contents preface xiii acknowledgments xv about this book xvii about the author xxi about the cover illustration 1 First steps 1.1 xxii 1 About Erlang 1 High availability 3 Erlang concurrency 3 Server-side systems 5 The development platform ■ ■ 1.2 About Elixir 8 Code simplification 9 The big picture 13 1.3 ■ Composing functions 12 Disadvantages 13 Speed 2 7 Building blocks 14 ■ Ecosystem 14 16 2.1 The interactive shell 17 2.2 Working with variables 2.3 Organizing your code 20 18 Modules 20 Functions 21 Function arity 25 Function visibility 26 Imports and aliases 27 Module attributes 28 Comments 30 ■ ■ ■ ■ vii viii contents 2.4 Understanding the type system 30 Numbers 30 Atoms 31 Tuples 34 Lists 35 Immutability 38 Maps 41 Binaries and bitstrings 43 Strings 44 First-class functions 46 Other built-in types 49 Higher-level types 50 IO lists ■ ■ ■ ■ ■ ■ ■ ■ ■ 2.5 Operators 55 2.6 Macros 56 2.7 Understanding the runtime 57 Modules and functions in the runtime the runtime 59 3 Control flow 3.1 54 57 Starting ■ 63 Pattern matching 64 The match operator 64 Matching tuples 64 Matching constants 65 Variables in patterns 66 Matching lists 67 Matching maps 68 Matching bitstrings and binaries 69 Compound matches 71 General behavior 72 ■ ■ ■ ■ ■ 3.2 Matching with functions 72 Multiclause functions 73 Multiclause lambdas 78 3.3 ■ Guards 76 Conditionals 79 Branching with multiclause functions 79 Classical branching constructs 81 The with special form 83 ■ ■ 3.4 Loops and iterations 86 Iterating with recursion 87 Tail function calls 88 Higher-order functions 91 Comprehensions 95 Streams ■ ■ 4 Data abstractions 4.1 ■ 102 Abstracting with modules 104 Basic abstraction 104 Composing abstractions 106 Structuring data with maps 107 Abstracting with structs 108 Data transparency 112 ■ ■ ■ 4.2 Working with hierarchical data 114 Generating IDs 115 Updating entries 117 Immutable hierarchical updates 119 Iterative updates 121 Exercise: importing from a file 122 ■ ■ ■ 97 ix contents 4.3 Polymorphism with protocols 124 Protocol basics 124 Implementing a protocol Built-in protocols 126 ■ 5 Concurrency primitives 129 5.1 Concurrency in BEAM 5.2 Working with processes Creating processes 133 5.3 125 130 132 ■ Message passing Stateful server processes 134 139 Server processes 139 Keeping a process state 144 Mutable state 145 Complex states 148 Registered processes 152 ■ ■ ■ 5.4 ■ Runtime considerations 153 A process is sequential 153 Unlimited process mailboxes 155 Shared-nothing concurrency 156 Scheduler inner workings 157 ■ ■ 6 Generic server processes 6.1 159 Building a generic server process 160 Plugging in with modules 160 Implementing the generic code 161 Using the generic abstraction 162 Supporting asynchronous requests 164 Exercise: refactoring the to-do server 166 ■ ■ ■ 6.2 Using GenServer 166 OTP behaviours 167 Plugging into GenServer 168 Handling requests 169 Handling plain messages 170 Other GenServer features 172 Process lifecycle 175 OTP-compliant processes 176 Exercise: GenServer-powered to-do server 177 ■ ■ ■ ■ 7 Building a concurrent system 179 7.1 Working with the mix project 180 7.2 Managing multiple to-do lists 182 Implementing a cache 182 Writing tests Analyzing process dependencies 188 ■ 7.3 Persisting data 185 189 Encoding and persisting 189 Using the database 191 Analyzing the system 194 Addressing the process bottleneck 195 Exercise: pooling and synchronizing 198 ■ ■ 7.4 Reasoning with processes 199 x contents 8 Fault-tolerance basics 8.1 201 Runtime errors 202 Error types 203 8.2 Handling errors ■ Errors in concurrent systems Linking processes 208 8.3 ■ 204 207 Monitors 210 Supervisors 211 Preparing the existing code 213 Starting the supervisor process 214 Child specification 216 Wrapping the supervisor 218 Using a callback module 218 Linking all processes 219 Restart frequency 222 ■ ■ ■ ■ ■ 9 Isolating error effects 9.1 224 Supervision trees 225 Separating loosely dependent parts 225 Rich process discovery 228 Via tuples 230 Registering database workers 232 Supervising database workers 234 Organizing the supervision tree 237 ■ ■ ■ ■ 9.2 Starting processes dynamically 241 Registering to-do servers 241 Dynamic supervision 242 Finding to-do servers 243 Using temporary restart strategy 244 Testing the system 245 ■ ■ ■ ■ 9.3 “Let it crash” 246 Processes that shouldn’t crash 247 Handling expected errors 248 Preserving the state 249 ■ ■ 10 Beyond GenServer 10.1 Tasks 251 252 Awaited tasks 252 10.2 Agents ■ Non-awaited tasks 254 256 Basic use 256 Agents and concurrency 257 to-do server 259 Limitations of agents 260 ■ ■ Agent-powered ■ 10.3 ETS tables 263 Basic operations 265 ETS powered key/value store 268 Other ETS operations 271 Exercise: process registry 274 ■ ■ xi contents 11 Working with components 11.1 OTP applications 277 278 Creating applications with the mix tool 278 The application behavior 280 Starting the application 280 Library applications 281 Creating a to-do application 282 The application folder structure 284 ■ ■ ■ ■ 11.2 Working with dependencies 286 Adding a dependency 286 Visualizing the system 289 11.3 Building a web server ■ Adapting the pool 287 291 Choosing dependencies 291 Starting the server 292 Handling requests 293 Reasoning about the system 296 ■ ■ 11.4 Configuring applications 300 Application environment 300 Varying configuration 301 Config script considerations ■ ■ 12 Building a distributed system 12.1 Distribution primitives 303 305 307 Starting a cluster 307 Communicating between nodes Process discovery 311 Links and monitors 314 Other distribution services 315 ■ ■ 12.2 Building a fault-tolerant cluster 317 Cluster design 318 The distributed to-do cache 318 Implementing a replicated database 323 Testing the system 326 Detecting partitions 327 Highly available systems 329 ■ ■ ■ ■ 12.3 Network considerations 330 Node names 330 Cookies 331 Hidden nodes 331 Firewalls 332 ■ ■ 13 Running the system 334 13.1 Running a system with Elixir tools 335 Using the mix and elixir commands 335 Running scripts 337 Compiling for production 338 ■ ■ 309 xii contents 13.2 OTP releases 339 Building a release with distillery 340 Release contents 343 ■ Using a release 13.3 Analyzing system behavior 346 Debugging 347 Logging 348 system 348 Tracing 350 ■ ■ index 353 ■ Interacting with the 341 preface In 2010, I was given the task of implementing a system to transmit frequent updates to a few thousand connected users in near real time.
Programming HTML5 Applications by Zachary Kessin
barriers to entry, continuous integration, fault tolerance, Firefox, functional programming, Google Chrome, higher-order functions, machine readable, mandelbrot fractal, QWERTY keyboard, SQL injection, web application, WebSocket
Chaining functions with a closure $('div.alert').text("Message").fadein (2000).click( function () { $(this).fadeout(2000); } ); One very powerful pattern of functional programming is the higher-order function. A higher-order function takes a function as an argument to abstract out specific behavior while leaving the generic behavior in the outer function. A good example of a higher-order function is the Array map function (see Array Iteration Operations). It takes an array and returns a new array that is the result of applying the passed function to each element in the array. This model can be applied to a wide range of circumstances beyond just array manipulation. As a general pattern, the higher-order function can be used wherever a generic behavior needs a few specific modifications.
…
URL query string separator, Debugging Manifest Files A Abelson, Harold, Functional Programming acceptance tests, Testing JavaScript Applications accessibility, Accessibility Through WAI-ARIA Accessible Rich Internet Applications, Accessibility Through WAI-ARIA actions, Selenium, Selenium Commands ActiveX controls, IndexedDB add() method (IndexedDB), Adding and Updating Records airplane mode, Adding Power to Web Applications Ajax, Developing Web Applications, Nonblocking I/O and Callbacks, Nonblocking I/O and Callbacks, Functional Programming, Functional Programming, A Simple Example, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Uploading Files, Structure of the Manifest File calls, Nonblocking I/O and Callbacks, Functional Programming, A Simple Example, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Structure of the Manifest File DataStore object, Nonblocking I/O and Callbacks uploading files with, Uploading Files versus XHR terminology, Functional Programming alert() method, Nonblocking I/O and Callbacks alt attribute, Accessibility Through WAI-ARIA Android, Selenium RC and a Test Farm, New Form Types _AndWait commands (Selenium), Selenium Commands anonymous functions, Lambda Functions Are Powerful Apache web server, Introduction to the Manifest File append() method, Uploading Files appending an image example, Working with Files Apple Safari, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing, Libraries for Web Workers, Web Sockets Aptana, JavaScript Tools You Should Know archive files, Drag-and-Drop array, Functional Programming, Array Iteration Operations, You Can Extend Objects, Too iteration operations, Array Iteration Operations, You Can Extend Objects, Too map function, Functional Programming assertElementPresent command (Selenium), Selenium Commands assertions, Selenium, Selenium Commands <audio> tag, Audio and Video automatic updates, Developing Web Applications B base types, extending, Prototypes and How to Expand Objects beforeload event handler, Offline Loading with a Data Store Benedetti, Ryan, JavaScript’s Triumph binary data, The Web Sockets Interface binding variables, Closures blob data type, Blobs BlobBuilder, Blobs Booleans as objects, Prototypes and How to Expand Objects bottlenecks, Splitting Up Work Through Web Workers, JavaScript Tools You Should Know Breadcrumbs specs, Microdata browsers, The Web As Application Platform, Developing Web Applications, Lambda Functions Are Powerful, Testing JavaScript Applications, Selenium RC and a Test Farm, Local Storage, jStore, Updates to the Manifest File, Updates to the Manifest File, Debugging Manifest Files (see also Chrome, Firefox, Internet Explorer, Safari) cache control header issues, Updates to the Manifest File, Debugging Manifest Files data storage and, Local Storage, jStore differences among, Testing JavaScript Applications function inside an if, Lambda Functions Are Powerful interactivity, The Web As Application Platform, Developing Web Applications testing on multiple, Selenium RC and a Test Farm buildMaster() method, Web Worker Fractal Example built-in objects, Prototypes and How to Expand Objects buttons, Lambda Functions Are Powerful, Closures, A Simple Example, Testing with QUnit, Selenium, Selenium Commands, Selenese Command Programming Interface click callbacks, Lambda Functions Are Powerful, A Simple Example, Testing with QUnit closures, Closures testing, Selenium, Selenese Command Programming Interface with XPath, Selenium Commands C C-type languages, Lambda Functions Are Powerful cache control headers, Updates to the Manifest File, Debugging Manifest Files cache() method, Expanding Functions with Prototypes Cagle, Kurt, Canvas and SVG callbacks, Nonblocking I/O and Callbacks, Lambda Functions Are Powerful, Closures, Array Iteration Operations, Testing JavaScript Applications, A Simple Example, Adding and Updating Records, Retrieving Data, Uploading Files, A Pattern for Reuse of Multithread Processing, Web Socket Example alternatives to for loops, Array Iteration Operations button, A Simple Example closures to construct, Closures cursor, Adding and Updating Records on DOM elements, Testing JavaScript Applications from ports, Web Socket Example and Web Workers, A Pattern for Reuse of Multithread Processing write, Retrieving Data XHMLHttpRequest, Uploading Files Canvas, Graphics, Web Worker Fractal Example <canvas> tag, Graphics changes, storing, Storing Changes for a Later Server Sync chat applications, Web Sockets checksum, manifest, Updates to the Manifest File Chrome, Google, JavaScript’s Triumph, Closures, Closures, The localStorage and sessionStorage Objects, The localStorage and sessionStorage Objects, IndexedDB, Blobs, Filesystem, Events, Events, Testing and Debugging Web Workers, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing, Web Sockets, Tags for Applications, JavaScript Tools You Should Know BlobBuilder support, Blobs debugging web workers in, Testing and Debugging Web Workers Dev tools, Closures, The localStorage and sessionStorage Objects, Testing and Debugging Web Workers filesystem access, Filesystem IndexedDB in, IndexedDB list of closed variables, Closures manifest list, Events postMessage() in, A Pattern for Reuse of Multithread Processing <progress> tag support, Tags for Applications Speed Tracer, JavaScript Tools You Should Know storage viewer, The localStorage and sessionStorage Objects, Events web socket support, Web Sockets web worker support in, A Pattern for Reuse of Multithread Processing Church, Alonzo, Lambda Functions Are Powerful click command (Selenium), Selenium Commands client-side data storage, Local Storage Clojure, Web Socket Example ClojureScript, JavaScript Tools You Should Know close() method, The Worker Environment, The Web Sockets Interface closures, Nonblocking I/O and Callbacks, Closures, Closures, Array Iteration Operations, IndexedDB cloud test farms, Automatically Running Tests CoffeeScript, JavaScript Tools You Should Know color form input, New Form Types composite functions, Functional Programming config files, web server, Introduction to the Manifest File confirm() method, Nonblocking I/O and Callbacks content delivery network, Taking It Offline controls attribute, Audio and Video cookies, The localStorage and sessionStorage Objects, Using localStorage in ExtJS, Web Sockets CouchDB, IndexedDB Cranley, Ronan, JavaScript’s Triumph createObjectURL() method, Blobs Crockford, Douglas, JavaScript’s Triumph, The Power of JavaScript, JavaScript Tools You Should Know cross-platform web development, Developing Web Applications CruiseControl, Selenese Command Programming Interface currying, Currying and Object Parameters D data record example, IndexedDB data storage, Adding Power to Web Applications, Local Storage, jStore data trees, You Can Extend Objects, Too databases, Adding Power to Web Applications, Local Storage, IndexedDB, Deleting Data, IndexedDB, Adding and Updating Records, Retrieving Data, Deleting Data adding and updating records, Adding and Updating Records deleting data from, Deleting Data IndexedDB, Adding Power to Web Applications, IndexedDB, Deleting Data retrieving data from, Retrieving Data SQLite, Local Storage DataStore object (Ajax), Nonblocking I/O and Callbacks date form input, New Form Types dblclick command (Selenium), Selenium Commands debugging, JavaScript’s Triumph, Lambda Functions Are Powerful, Debugging Manifest Files, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers, JavaScript Tools You Should Know Firebug, JavaScript’s Triumph, Lambda Functions Are Powerful and JSMin, JavaScript Tools You Should Know manifest files, Debugging Manifest Files and Web Workers, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers $.decode() method (Hive API), Libraries for Web Workers decoratedFib(), Expanding Functions with Prototypes deepEqual() method, Testing with QUnit defer() method, Offline Loading with a Data Store degradation, handling, Testing JavaScript Applications deleteEach() method, Deleting Data doConditionalLoad() method, Offline Loading with a Data Store DOM (Document Object Model), The Web As Application Platform, Developing Web Applications, Testing JavaScript Applications downloading events, Events Drag and Drop widget, JavaScript Tools You Should Know drag-and-drop, Selenium Commands, Files, Drag-and-Drop Dragonfly, Opera, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing drop event (DOM), Drag-and-Drop drop handler example, Working with Files drop zone example, Putting It All Together DSt library, DSt E Eclipse, JavaScript Tools You Should Know ECMAScript objects, The Worker Environment Emacs JS2 mode, JavaScript Tools You Should Know email form input, New Form Types enclosing scope, Lambda Functions Are Powerful $.encode() method (Hive API), Libraries for Web Workers engines available in JQuery, jStore equal() method, A Simple Example, Testing with QUnit Erlang Yaws, Web Socket Example, Erlang Yaws errors, Retrieving Data, Events, Testing and Debugging Web Workers, Geolocation ETags, Offline Loading with a Data Store event loops, Splitting Up Work Through Web Workers, JavaScript Tools You Should Know Event Machine, Ruby, Ruby Event Machine Events specs, Microdata every() method, Array Iteration Operations expanding functions with prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes extending base types, Prototypes and How to Expand Objects ExtJS, JavaScript’s Triumph, Lambda Functions Are Powerful, Currying and Object Parameters, Selenium Commands, Using localStorage in ExtJS button with function as handler, Lambda Functions Are Powerful click event problems, Selenium Commands currying parameters in, Currying and Object Parameters library, JavaScript’s Triumph localStorage object in, Using localStorage in ExtJS F FALLBACK section, manifest, Structure of the Manifest File feature detection, A Pattern for Reuse of Multithread Processing Fibonacci sequences, calculating, Expanding Functions with Prototypes FileReader API, Working with Files files, Adding Power to Web Applications, Files, Filesystem, Debugging Manifest Files FileSystem API, Filesystem filter() method, Array Iteration Operations, You Can Extend Objects, Too Firebug, JavaScript’s Triumph, Lambda Functions Are Powerful, Closures, The localStorage and sessionStorage Objects, Working with Files, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers, Testing and Debugging Web Workers, JavaScript Tools You Should Know anonymous functions, Lambda Functions Are Powerful colorizing in script tag, JavaScript Tools You Should Know debugging web workers in, Testing and Debugging Web Workers developer tools, Testing and Debugging Web Workers editing storage object, The localStorage and sessionStorage Objects full path file names, Working with Files scope chain, Closures and Web Workers, Splitting Up Work Through Web Workers Firefox, Mozilla, Prototypes and How to Expand Objects, Array Iteration Operations, Array Iteration Operations, Selenium, Constructing Tests with the Selenium IDE, The localStorage and sessionStorage Objects, IndexedDB, Blobs, Debugging Manifest Files, Debugging Manifest Files, Worker Communication, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing, Web Sockets, Tags for Applications developers’ site, Prototypes and How to Expand Objects, Array Iteration Operations IndexedDB in, IndexedDB iteration methods in, Array Iteration Operations manifest file opt-in issue, Debugging Manifest Files MozBlobBuilder, Blobs MozWebSockets, Web Sockets passing complex JavaScript objects, Worker Communication postMessage() in, A Pattern for Reuse of Multithread Processing <progress> tag support, Tags for Applications Selenium IDE for, Selenium, Constructing Tests with the Selenium IDE, Debugging Manifest Files storage objects in, The localStorage and sessionStorage Objects web workers in, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing FireRainbow, JavaScript Tools You Should Know first class citizens, Lambda Functions Are Powerful, Functional Programming :first-child() CSS selector, New CSS Flanagan, David, The Power of JavaScript flow control, Selenium Commands for loops, alternatives to, Array Iteration Operations forks, Adding Power to Web Applications FormData interface, Uploading Files fractal computation examples, Web Worker Fractal Example, Web Worker Fractal Example Fulton, Jeff, Graphics, Canvas and SVG Fulton, Steve, Graphics, Canvas and SVG function expressions, Lambda Functions Are Powerful function generators, Closures function interceptor example, Expanding Functions with Prototypes Function prototype, Expanding Functions with Prototypes function statements, Lambda Functions Are Powerful functional programming, Functional Programming, Functional Programming, JavaScript Tools You Should Know functions, Lambda Functions Are Powerful, Lambda Functions Are Powerful, Closures, Functional Programming, Functional Programming anonymous, Lambda Functions Are Powerful as first class citizens, Lambda Functions Are Powerful, Functional Programming higher order, Functional Programming inner and outer, Closures functions, expanding with prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes G Garret, Jesse James, Functional Programming Gears, Google, Developing Web Applications, Local Storage, Introduction to the Manifest File, Splitting Up Work Through Web Workers offline file access, Introduction to the Manifest File SQLite database, Local Storage worker pool, Splitting Up Work Through Web Workers geolocation, Maps, Geolocation $.get() method (Hive API), Libraries for Web Workers getBlob() method (BlobBuilder), Blobs getCurrentPosition() method, Geolocation getEval() method (Selenese API), Selenese Command Programming Interface getText() method (Selenese API), Selenese Command Programming Interface getXpathCount() method (Selenese API), Selenese Command Programming Interface Gmail, Google’s, Files, Web Sockets Goerzen, John, Functional Programming Google Chrome, Tags for Applications (see Chrome, Google) Google Gears, Developing Web Applications (see Gears, Google) Google search predefined vocabularies, Microdata Google Web Toolkit, JavaScript’s Triumph grid object (ExtJS), Using localStorage in ExtJS H handleButtonClick() function, A Simple Example Haskell, Currying and Object Parameters Head First jQuery (Benedetti & Cranley), JavaScript’s Triumph Hello World testing example, Selenese Command Programming Interface Hickey, Rich, JavaScript Tools You Should Know High Performance JavaScript (Zakas), The Power of JavaScript High Performance Web Sites (Souders), JavaScript Tools You Should Know higher order functions, Functional Programming hoisting, Lambda Functions Are Powerful <hr> tag, Accessibility Through WAI-ARIA, Accessibility Through WAI-ARIA, Accessibility Through WAI-ARIA HTML 5, Putting It All Together, Introduction to the Manifest File, Graphics, Web Worker Fractal Example, New Tags, New CSS, New Form Types, Canvas and SVG, New CSS Canvas, Graphics, Web Worker Fractal Example, Canvas and SVG manifest declaration example, Introduction to the Manifest File new CSS features, New CSS new form types, New Form Types new tags, New Tags, New CSS progress bar, Putting It All Together HTML5 Canvas (Fulton & Fulton), Graphics, Canvas and SVG HTML5 Graphics with SVG & CSS3 (Cagle), Canvas and SVG HTML5 Media (Powers), Audio and Video HTML5 Rocks tutorial, Canvas and SVG HTTP (Hypertext Transfer Protocol), Adding Power to Web Applications, Web Sockets, Erlang Yaws I I/O, Nonblocking I/O and Callbacks IDs, importance of assigning, Selenium if statement, Lambda Functions Are Powerful images, Functional Programming, Blobs, Working with Files, Drag-and-Drop, Filesystem, Filesystem, Debugging Manifest Files, Graphics, Graphics, Graphics, Web Worker Fractal Example, Canvas and SVG appending to documents, Working with Files and Canvas, Graphics editing, Filesystem, Graphics missing, Debugging Manifest Files progressive drawing, Web Worker Fractal Example scaling example, Functional Programming streaming video, Filesystem SVG, Canvas and SVG use of src attribute, Blobs, Graphics user access to, Drag-and-Drop <img> tag, Graphics, Accessibility Through WAI-ARIA importScripts() method, The Worker Environment independent event loops, Splitting Up Work Through Web Workers index() method, Adding Indexes IndexedDB, Adding Power to Web Applications, IndexedDB, Deleting Data indexes, adding/removing, Adding Indexes indexOf() method, Prototypes and How to Expand Objects info() method, Web Worker Fractal Example inner functions, Closures integration testing, Testing JavaScript Applications, Selenium interceptor methods, Expanding Functions with Prototypes Internet Explorer (IE), Microsoft, Array Iteration Operations, IndexedDB, A Pattern for Reuse of Multithread Processing iOS Selenium, testing applications for, Selenium RC and a Test Farm iPad/iPod/iPhone platform, Selenium RC and a Test Farm, A Pattern for Reuse of Multithread Processing isDuplicate() method, Deleting Data isElementPresent() method (Selenese API), Selenese Command Programming Interface isTextPresent() method (Selenese API), Selenese Command Programming Interface itemprop attribute, Microdata itemscope attribute, Microdata itemtype attribute, Microdata J JavaScript, JavaScript’s Triumph, JavaScript’s Triumph, Nonblocking I/O and Callbacks, Lambda Functions Are Powerful, Lambda Functions Are Powerful, Closures, Functional Programming, Functional Programming, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Currying and Object Parameters, Array Iteration Operations, You Can Extend Objects, Too, You Can Extend Objects, Too, Testing JavaScript Applications, Splitting Up Work Through Web Workers, Worker Communication, JavaScript Tools You Should Know, JavaScript Tools You Should Know, JavaScript Tools You Should Know array iteration operations, Array Iteration Operations, You Can Extend Objects, Too closures, Closures currying and object parameters, Currying and Object Parameters expanding functions, Expanding Functions with Prototypes, Expanding Functions with Prototypes expanding objects, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects extending objects, You Can Extend Objects, Too function statement and function expression, Lambda Functions Are Powerful functional programming in, Functional Programming, Functional Programming functions act as data in, Lambda Functions Are Powerful helpful tools for, JavaScript Tools You Should Know, JavaScript Tools You Should Know libraries, JavaScript’s Triumph nonblocking I/O and callbacks, Nonblocking I/O and Callbacks passing objects in Firefox, Worker Communication primitives in, Prototypes and How to Expand Objects prototypes, Prototypes and How to Expand Objects, Expanding Functions with Prototypes recent improvements in, JavaScript’s Triumph runtime event loop, Splitting Up Work Through Web Workers runtime model, Testing JavaScript Applications syntax checker, JavaScript Tools You Should Know JavaScript Patterns (Stefanov), The Power of JavaScript JavaScript: The Definitive Guide (Flanagan), The Power of JavaScript JavaScript: The Good Parts (Crockford), JavaScript’s Triumph, The Power of JavaScript, JavaScript Tools You Should Know jQuery, JavaScript’s Triumph, Functional Programming, DSt, jStore, IndexedDB, IndexedDB, Libraries for Web Workers DSt plug-in, DSt Hive extension, Libraries for Web Workers IndexedDB plug-in, IndexedDB, IndexedDB jStore plug-in, jStore library, JavaScript’s Triumph, Functional Programming jQuery Cookbook (Lindley), JavaScript’s Triumph JS2 mode, Emacs, JavaScript Tools You Should Know JSBeautifier, JavaScript Tools You Should Know JSLint, The Power of JavaScript, JavaScript Tools You Should Know JSMin, JavaScript Tools You Should Know JSON manifest file, Introduction to the Manifest File JsonStore object, Offline Loading with a Data Store jStore plug-in, jStore L Lambda Calculus, Lambda Functions Are Powerful lambda functions, Lambda Functions Are Powerful lastIndexOf(), Prototypes and How to Expand Objects libraries, JavaScript’s Triumph, Libraries for Web Workers Lindley, Cody, JavaScript’s Triumph Lisp lambdas, Lambda Functions Are Powerful list recursion, Functional Programming list test examples, Testing JavaScript Applications load() method (JSON), Offline Loading with a Data Store local data storage, Adding Power to Web Applications, Local Storage, jStore local state provider, ExtJS, Using localStorage in ExtJS localStorage object, The localStorage and sessionStorage Objects, Using localStorage in ExtJS, Storing Changes for a Later Server Sync location object, The Worker Environment loops, Array Iteration Operations, Selenium Commands, Splitting Up Work Through Web Workers, Splitting Up Work Through Web Workers, A Pattern for Reuse of Multithread Processing for, Array Iteration Operations independent event, Splitting Up Work Through Web Workers runtime event, Splitting Up Work Through Web Workers and Selenium, Selenium Commands while, A Pattern for Reuse of Multithread Processing M macros, recording web, Selenium Mandelbrot computation examples, Web Worker Fractal Example, Web Worker Fractal Example manifest file, Adding Power to Web Applications, Introduction to the Manifest File, Debugging Manifest Files map() method, Array Iteration Operations, You Can Extend Objects, Too match() method, Prototypes and How to Expand Objects McCarthy, John, Lambda Functions Are Powerful MD5 checksum, Updates to the Manifest File memory leaks, Selenium Commands <meter> tag, Tags for Applications microdata, Microdata Microsoft Internet Explorer, Array Iteration Operations, IndexedDB, A Pattern for Reuse of Multithread Processing minification, JavaScript Tools You Should Know MongoDB, IndexedDB mouseDown command (Selenium), Selenium Commands mouseOver command (Selenium), Selenium Commands mouseUp command (Selenium), Selenium Commands MozBlobBuilder, Blobs Mozilla Firefox, Prototypes and How to Expand Objects (see Firefox, Mozilla) mozSlice() method (Firefox), Blobs MozWebSockets, Web Sockets N name/value pairs, Currying and Object Parameters navigator object, The Worker Environment .NET/CLR, Web Socket Example NETWORK section, manifest, Structure of the Manifest File node trees, You Can Extend Objects, Too Node.js, Web Sockets, Web Socket Example, JavaScript Tools You Should Know nonblocking I/O, Nonblocking I/O and Callbacks :not() CSS selector, New CSS notDeepEqual() method, Testing with QUnit notEqual() method, Testing with QUnit notStrictEqual() method, Testing with QUnit noupdate events, Events :nth-child() CSS selector, New CSS number form input, New Form Types numbers, Lambda Functions Are Powerful, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Array Iteration Operations cubing example, Expanding Functions with Prototypes Fibonacci calculation examples, Expanding Functions with Prototypes, Expanding Functions with Prototypes as objects, Prototypes and How to Expand Objects squaring examples, Lambda Functions Are Powerful, Prototypes and How to Expand Objects, Array Iteration Operations O object parameters, Currying and Object Parameters object stores, IndexedDB, IndexedDB, Retrieving Data objects, extending, You Can Extend Objects, Too Offer-Aggregates specs, Microdata Offers specs, Microdata offline use, Local Storage, Offline Loading with a Data Store, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Introduction to the Manifest File, Debugging Manifest Files data access, Local Storage loading with data store, Offline Loading with a Data Store, Offline Loading with a Data Store manifest file, Introduction to the Manifest File, Debugging Manifest Files storing changes, Storing Changes for a Later Server Sync ok() method, Testing with QUnit onclose() method, The Web Sockets Interface onmessage() method, Using Web Workers, Web Worker Fractal Example, A Pattern for Reuse of Multithread Processing onopen() method, The Web Sockets Interface open command (Selenium), Selenium Commands Opera Dragonfly, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing Organizations specs, Microdata outer functions, Closures O’Reilly Answers website, The Power of JavaScript O’Sullivan, Bryan, Functional Programming P parameter blocks, Currying and Object Parameters path() method, You Can Extend Objects, Too pattern for reuse of multithread processing, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Payne, Alex, Functional Programming People specs, Microdata persistent local storage, Local Storage PhoneGap, Developing Web Applications PHP, Lambda Functions Are Powerful phpUnderControl, Selenese Command Programming Interface PHPUnit testing framework, Automatically Running Tests, Selenese Command Programming Interface pixel, drawing a, Web Worker Fractal Example PollenJS library, Libraries for Web Workers populate_form() method (DSt), DSt populating (example), Prototypes and How to Expand Objects port 443 (wss), Setting Up a Web Socket port 80 (ws), Setting Up a Web Socket port 8080, Web Socket Example $.post() method (Hive API), Libraries for Web Workers postMessage() method, Using Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Powers, Shelley, Audio and Video PreloadStore object (JSON), Offline Loading with a Data Store pretty printer example, JavaScript Tools You Should Know primitives in JavaScript, Prototypes and How to Expand Objects Products specs, Microdata Programming Scala (Wampler & Payne), Functional Programming progress events, Events progress indicator examples, Putting It All Together, Tags for Applications <progress> tag, Tags for Applications prompt() method, Nonblocking I/O and Callbacks prototype object, Prototypes and How to Expand Objects prototypes, expanding functions with, Expanding Functions with Prototypes, Expanding Functions with Prototypes Q query access, IndexedDB QUnit, Testing JavaScript Applications, QUnit, Testing with QUnit, Running QUnit from Selenium R race conditions, IndexedDB, Splitting Up Work Through Web Workers raises() method, Testing with QUnit rar files, Drag-and-Drop RC server, Selenium, Selenium readAsArrayBuffer() method (FileReader), Working with Files readAsBinaryString() method (FileReader), Working with Files readAsText() method (FileReader), Working with Files readDataAsURL() method (FileReader), Working with Files Real World Haskell (Goerzen & Stewart), Functional Programming recall() method (DSt), DSt reduce(), reduceRight() methods, Array Iteration Operations refresh command (Selenium), Selenium Commands remove() method, Deleting Data replace() method, Prototypes and How to Expand Objects required attribute (forms), New Form Types Resig, John, JavaScript’s Triumph reuse of multithread processing, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Review-Aggregates specs, Microdata Reviews specs, Microdata revokeBlobURL() method, Blobs Rhino, JavaScript Tools You Should Know role attribute, Accessibility Through WAI-ARIA route finder, Maps Ruby, Web Socket Example Ruby Event Machine, Ruby Event Machine run function example, A Pattern for Reuse of Multithread Processing run() method, Web Worker Fractal Example running average example, Array Iteration Operations runtime model, JavaScript, Testing JavaScript Applications S Safari Nightly builds, Blobs Safari, Apple’s, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing, Libraries for Web Workers, Web Sockets same origin policy, The localStorage and sessionStorage Objects, IndexedDB sandboxed environment, Developing Web Applications, Filesystem save queue examples, Storing Changes for a Later Server Sync Scala, Web Socket Example Scalable Vector Graphics, Canvas and SVG scaling images, Functional Programming scope, Lambda Functions Are Powerful, Closures <script> tag, The Worker Environment search form input, New Form Types Selenese, Selenium Commands, Selenese Command Programming Interface, Selenese Command Programming Interface Selenium, Testing JavaScript Applications, Selenium, Selenium, Selenium, Selenium Commands, Selenium Commands, Selenium Commands, Constructing Tests with the Selenium IDE, Constructing Tests with the Selenium IDE, Automatically Running Tests, Automatically Running Tests, Selenese Command Programming Interface, Selenese Command Programming Interface, Running QUnit from Selenium, Drag-and-Drop automatically running tests, Automatically Running Tests, Automatically Running Tests commands, Selenium Commands, Selenium Commands constructing tests, Constructing Tests with the Selenium IDE example tests, Selenium IDE, Selenium, Constructing Tests with the Selenium IDE location options, Selenium Commands no drag-and-drop, Drag-and-Drop running QUnit from, Running QUnit from Selenium Selenese, Selenese Command Programming Interface, Selenese Command Programming Interface test table, Selenium Selenium Grid, Automatically Running Tests Selenium RC server, Selenium, Selenium RC and a Test Farm self object, The Worker Environment Sencha ExtJS library, JavaScript’s Triumph send(“data”) method, The Web Sockets Interface server delay, Developing Web Applications, Web Sockets server polling, Web Sockets server-side testing, Testing JavaScript Applications, Testing JavaScript Applications, Selenese Command Programming Interface sessionStorage object, The localStorage and sessionStorage Objects, Using localStorage in ExtJS setInterval() method, Expanding Functions with Prototypes, The Worker Environment setTimeout() method, Expanding Functions with Prototypes, Testing with QUnit, The Worker Environment, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing setVersion transaction, Adding Indexes side effects, Functional Programming single-step mode, Selenium sleep() method, Selenese Command Programming Interface slice() method, Prototypes and How to Expand Objects, Blobs slider, form, New Form Types smartphones, Developing Web Applications some() method, Array Iteration Operations Souders, Steve, JavaScript Tools You Should Know speech input type, New Form Types Speed Tracer, JavaScript Tools You Should Know speed, data storage and, Local Storage split() method, Prototypes and How to Expand Objects SQL Injection attacks, IndexedDB SQLite versus IndexedDB, IndexedDB squaring numbers example, Prototypes and How to Expand Objects src attribute, Audio and Video StackOverflow website, The Power of JavaScript startWorker() method, Web Worker Fractal Example static data storage, Local Storage Stefanov, Stoyan, The Power of JavaScript step through, Selenium, Testing and Debugging Web Workers Stewart, Donald Bruce, Functional Programming stock price examples, Web Socket Example, Ruby Event Machine stop() method, A Pattern for Reuse of Multithread Processing storage events, The localStorage and sessionStorage Objects storage viewer widget, The localStorage and sessionStorage Objects $.storage() method (Hive API), Libraries for Web Workers store() method (DSt), DSt store_form() method (DSt), DSt strictEqual() method, Testing with QUnit string token replacement, Prototypes and How to Expand Objects strings, methods for, Prototypes and How to Expand Objects Structure and Interpretation of Computer Programs (Abelson & Sussman), Functional Programming structured data, query access to, IndexedDB subclassing, Currying and Object Parameters Sussman, Gerald Jay, Functional Programming SVG, Canvas and SVG <svg> tag, Graphics Symfony Yaml Library, Updates to the Manifest File T tar files, Drag-and-Drop TCP socket, Web Socket Protocol TCP/IP sockets, Web Sockets tel form input, New Form Types test machines, Automatically Running Tests test suites, Testing JavaScript Applications, QUnit, Testing with QUnit, Selenium, Selenium RC and a Test Farm, Selenium, Selenium, Running QUnit from Selenium programming language based, Selenium QUnit, QUnit, Testing with QUnit, Selenium, Running QUnit from Selenium Selenium, Selenium, Selenium RC and a Test Farm server-side, Testing JavaScript Applications Test-driven development, Testing JavaScript Applications, Testing JavaScript Applications thread safety, Splitting Up Work Through Web Workers threads, Adding Power to Web Applications time form input, New Form Types title attribute, Accessibility Through WAI-ARIA transaction object, database, IndexedDB transaction.abort() method (jQuery), IndexedDB transaction.done() method (jQuery), IndexedDB True Type font files, New CSS type command (Selenium), Selenium Commands U undefined value, Functional Programming unit testing, Testing JavaScript Applications update() method (IndexedDB), Adding and Updating Records updateEach() method (IndexedDB), Adding and Updating Records uploading files, Uploading Files URLs, QUnit, Blobs, Working with Files, Structure of the Manifest File, Events, Events, Debugging Manifest Files, The Web Sockets Interface adding ?
…
URL query string separator, Debugging Manifest Files A Abelson, Harold, Functional Programming acceptance tests, Testing JavaScript Applications accessibility, Accessibility Through WAI-ARIA Accessible Rich Internet Applications, Accessibility Through WAI-ARIA actions, Selenium, Selenium Commands ActiveX controls, IndexedDB add() method (IndexedDB), Adding and Updating Records airplane mode, Adding Power to Web Applications Ajax, Developing Web Applications, Nonblocking I/O and Callbacks, Nonblocking I/O and Callbacks, Functional Programming, Functional Programming, A Simple Example, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Uploading Files, Structure of the Manifest File calls, Nonblocking I/O and Callbacks, Functional Programming, A Simple Example, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Structure of the Manifest File DataStore object, Nonblocking I/O and Callbacks uploading files with, Uploading Files versus XHR terminology, Functional Programming alert() method, Nonblocking I/O and Callbacks alt attribute, Accessibility Through WAI-ARIA Android, Selenium RC and a Test Farm, New Form Types _AndWait commands (Selenium), Selenium Commands anonymous functions, Lambda Functions Are Powerful Apache web server, Introduction to the Manifest File append() method, Uploading Files appending an image example, Working with Files Apple Safari, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing, Libraries for Web Workers, Web Sockets Aptana, JavaScript Tools You Should Know archive files, Drag-and-Drop array, Functional Programming, Array Iteration Operations, You Can Extend Objects, Too iteration operations, Array Iteration Operations, You Can Extend Objects, Too map function, Functional Programming assertElementPresent command (Selenium), Selenium Commands assertions, Selenium, Selenium Commands <audio> tag, Audio and Video automatic updates, Developing Web Applications B base types, extending, Prototypes and How to Expand Objects beforeload event handler, Offline Loading with a Data Store Benedetti, Ryan, JavaScript’s Triumph binary data, The Web Sockets Interface binding variables, Closures blob data type, Blobs BlobBuilder, Blobs Booleans as objects, Prototypes and How to Expand Objects bottlenecks, Splitting Up Work Through Web Workers, JavaScript Tools You Should Know Breadcrumbs specs, Microdata browsers, The Web As Application Platform, Developing Web Applications, Lambda Functions Are Powerful, Testing JavaScript Applications, Selenium RC and a Test Farm, Local Storage, jStore, Updates to the Manifest File, Updates to the Manifest File, Debugging Manifest Files (see also Chrome, Firefox, Internet Explorer, Safari) cache control header issues, Updates to the Manifest File, Debugging Manifest Files data storage and, Local Storage, jStore differences among, Testing JavaScript Applications function inside an if, Lambda Functions Are Powerful interactivity, The Web As Application Platform, Developing Web Applications testing on multiple, Selenium RC and a Test Farm buildMaster() method, Web Worker Fractal Example built-in objects, Prototypes and How to Expand Objects buttons, Lambda Functions Are Powerful, Closures, A Simple Example, Testing with QUnit, Selenium, Selenium Commands, Selenese Command Programming Interface click callbacks, Lambda Functions Are Powerful, A Simple Example, Testing with QUnit closures, Closures testing, Selenium, Selenese Command Programming Interface with XPath, Selenium Commands C C-type languages, Lambda Functions Are Powerful cache control headers, Updates to the Manifest File, Debugging Manifest Files cache() method, Expanding Functions with Prototypes Cagle, Kurt, Canvas and SVG callbacks, Nonblocking I/O and Callbacks, Lambda Functions Are Powerful, Closures, Array Iteration Operations, Testing JavaScript Applications, A Simple Example, Adding and Updating Records, Retrieving Data, Uploading Files, A Pattern for Reuse of Multithread Processing, Web Socket Example alternatives to for loops, Array Iteration Operations button, A Simple Example closures to construct, Closures cursor, Adding and Updating Records on DOM elements, Testing JavaScript Applications from ports, Web Socket Example and Web Workers, A Pattern for Reuse of Multithread Processing write, Retrieving Data XHMLHttpRequest, Uploading Files Canvas, Graphics, Web Worker Fractal Example <canvas> tag, Graphics changes, storing, Storing Changes for a Later Server Sync chat applications, Web Sockets checksum, manifest, Updates to the Manifest File Chrome, Google, JavaScript’s Triumph, Closures, Closures, The localStorage and sessionStorage Objects, The localStorage and sessionStorage Objects, IndexedDB, Blobs, Filesystem, Events, Events, Testing and Debugging Web Workers, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing, Web Sockets, Tags for Applications, JavaScript Tools You Should Know BlobBuilder support, Blobs debugging web workers in, Testing and Debugging Web Workers Dev tools, Closures, The localStorage and sessionStorage Objects, Testing and Debugging Web Workers filesystem access, Filesystem IndexedDB in, IndexedDB list of closed variables, Closures manifest list, Events postMessage() in, A Pattern for Reuse of Multithread Processing <progress> tag support, Tags for Applications Speed Tracer, JavaScript Tools You Should Know storage viewer, The localStorage and sessionStorage Objects, Events web socket support, Web Sockets web worker support in, A Pattern for Reuse of Multithread Processing Church, Alonzo, Lambda Functions Are Powerful click command (Selenium), Selenium Commands client-side data storage, Local Storage Clojure, Web Socket Example ClojureScript, JavaScript Tools You Should Know close() method, The Worker Environment, The Web Sockets Interface closures, Nonblocking I/O and Callbacks, Closures, Closures, Array Iteration Operations, IndexedDB cloud test farms, Automatically Running Tests CoffeeScript, JavaScript Tools You Should Know color form input, New Form Types composite functions, Functional Programming config files, web server, Introduction to the Manifest File confirm() method, Nonblocking I/O and Callbacks content delivery network, Taking It Offline controls attribute, Audio and Video cookies, The localStorage and sessionStorage Objects, Using localStorage in ExtJS, Web Sockets CouchDB, IndexedDB Cranley, Ronan, JavaScript’s Triumph createObjectURL() method, Blobs Crockford, Douglas, JavaScript’s Triumph, The Power of JavaScript, JavaScript Tools You Should Know cross-platform web development, Developing Web Applications CruiseControl, Selenese Command Programming Interface currying, Currying and Object Parameters D data record example, IndexedDB data storage, Adding Power to Web Applications, Local Storage, jStore data trees, You Can Extend Objects, Too databases, Adding Power to Web Applications, Local Storage, IndexedDB, Deleting Data, IndexedDB, Adding and Updating Records, Retrieving Data, Deleting Data adding and updating records, Adding and Updating Records deleting data from, Deleting Data IndexedDB, Adding Power to Web Applications, IndexedDB, Deleting Data retrieving data from, Retrieving Data SQLite, Local Storage DataStore object (Ajax), Nonblocking I/O and Callbacks date form input, New Form Types dblclick command (Selenium), Selenium Commands debugging, JavaScript’s Triumph, Lambda Functions Are Powerful, Debugging Manifest Files, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers, JavaScript Tools You Should Know Firebug, JavaScript’s Triumph, Lambda Functions Are Powerful and JSMin, JavaScript Tools You Should Know manifest files, Debugging Manifest Files and Web Workers, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers $.decode() method (Hive API), Libraries for Web Workers decoratedFib(), Expanding Functions with Prototypes deepEqual() method, Testing with QUnit defer() method, Offline Loading with a Data Store degradation, handling, Testing JavaScript Applications deleteEach() method, Deleting Data doConditionalLoad() method, Offline Loading with a Data Store DOM (Document Object Model), The Web As Application Platform, Developing Web Applications, Testing JavaScript Applications downloading events, Events Drag and Drop widget, JavaScript Tools You Should Know drag-and-drop, Selenium Commands, Files, Drag-and-Drop Dragonfly, Opera, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing drop event (DOM), Drag-and-Drop drop handler example, Working with Files drop zone example, Putting It All Together DSt library, DSt E Eclipse, JavaScript Tools You Should Know ECMAScript objects, The Worker Environment Emacs JS2 mode, JavaScript Tools You Should Know email form input, New Form Types enclosing scope, Lambda Functions Are Powerful $.encode() method (Hive API), Libraries for Web Workers engines available in JQuery, jStore equal() method, A Simple Example, Testing with QUnit Erlang Yaws, Web Socket Example, Erlang Yaws errors, Retrieving Data, Events, Testing and Debugging Web Workers, Geolocation ETags, Offline Loading with a Data Store event loops, Splitting Up Work Through Web Workers, JavaScript Tools You Should Know Event Machine, Ruby, Ruby Event Machine Events specs, Microdata every() method, Array Iteration Operations expanding functions with prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes extending base types, Prototypes and How to Expand Objects ExtJS, JavaScript’s Triumph, Lambda Functions Are Powerful, Currying and Object Parameters, Selenium Commands, Using localStorage in ExtJS button with function as handler, Lambda Functions Are Powerful click event problems, Selenium Commands currying parameters in, Currying and Object Parameters library, JavaScript’s Triumph localStorage object in, Using localStorage in ExtJS F FALLBACK section, manifest, Structure of the Manifest File feature detection, A Pattern for Reuse of Multithread Processing Fibonacci sequences, calculating, Expanding Functions with Prototypes FileReader API, Working with Files files, Adding Power to Web Applications, Files, Filesystem, Debugging Manifest Files FileSystem API, Filesystem filter() method, Array Iteration Operations, You Can Extend Objects, Too Firebug, JavaScript’s Triumph, Lambda Functions Are Powerful, Closures, The localStorage and sessionStorage Objects, Working with Files, Splitting Up Work Through Web Workers, Testing and Debugging Web Workers, Testing and Debugging Web Workers, JavaScript Tools You Should Know anonymous functions, Lambda Functions Are Powerful colorizing in script tag, JavaScript Tools You Should Know debugging web workers in, Testing and Debugging Web Workers developer tools, Testing and Debugging Web Workers editing storage object, The localStorage and sessionStorage Objects full path file names, Working with Files scope chain, Closures and Web Workers, Splitting Up Work Through Web Workers Firefox, Mozilla, Prototypes and How to Expand Objects, Array Iteration Operations, Array Iteration Operations, Selenium, Constructing Tests with the Selenium IDE, The localStorage and sessionStorage Objects, IndexedDB, Blobs, Debugging Manifest Files, Debugging Manifest Files, Worker Communication, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing, Web Sockets, Tags for Applications developers’ site, Prototypes and How to Expand Objects, Array Iteration Operations IndexedDB in, IndexedDB iteration methods in, Array Iteration Operations manifest file opt-in issue, Debugging Manifest Files MozBlobBuilder, Blobs MozWebSockets, Web Sockets passing complex JavaScript objects, Worker Communication postMessage() in, A Pattern for Reuse of Multithread Processing <progress> tag support, Tags for Applications Selenium IDE for, Selenium, Constructing Tests with the Selenium IDE, Debugging Manifest Files storage objects in, The localStorage and sessionStorage Objects web workers in, Testing and Debugging Web Workers, A Pattern for Reuse of Multithread Processing FireRainbow, JavaScript Tools You Should Know first class citizens, Lambda Functions Are Powerful, Functional Programming :first-child() CSS selector, New CSS Flanagan, David, The Power of JavaScript flow control, Selenium Commands for loops, alternatives to, Array Iteration Operations forks, Adding Power to Web Applications FormData interface, Uploading Files fractal computation examples, Web Worker Fractal Example, Web Worker Fractal Example Fulton, Jeff, Graphics, Canvas and SVG Fulton, Steve, Graphics, Canvas and SVG function expressions, Lambda Functions Are Powerful function generators, Closures function interceptor example, Expanding Functions with Prototypes Function prototype, Expanding Functions with Prototypes function statements, Lambda Functions Are Powerful functional programming, Functional Programming, Functional Programming, JavaScript Tools You Should Know functions, Lambda Functions Are Powerful, Lambda Functions Are Powerful, Closures, Functional Programming, Functional Programming anonymous, Lambda Functions Are Powerful as first class citizens, Lambda Functions Are Powerful, Functional Programming higher order, Functional Programming inner and outer, Closures functions, expanding with prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes G Garret, Jesse James, Functional Programming Gears, Google, Developing Web Applications, Local Storage, Introduction to the Manifest File, Splitting Up Work Through Web Workers offline file access, Introduction to the Manifest File SQLite database, Local Storage worker pool, Splitting Up Work Through Web Workers geolocation, Maps, Geolocation $.get() method (Hive API), Libraries for Web Workers getBlob() method (BlobBuilder), Blobs getCurrentPosition() method, Geolocation getEval() method (Selenese API), Selenese Command Programming Interface getText() method (Selenese API), Selenese Command Programming Interface getXpathCount() method (Selenese API), Selenese Command Programming Interface Gmail, Google’s, Files, Web Sockets Goerzen, John, Functional Programming Google Chrome, Tags for Applications (see Chrome, Google) Google Gears, Developing Web Applications (see Gears, Google) Google search predefined vocabularies, Microdata Google Web Toolkit, JavaScript’s Triumph grid object (ExtJS), Using localStorage in ExtJS H handleButtonClick() function, A Simple Example Haskell, Currying and Object Parameters Head First jQuery (Benedetti & Cranley), JavaScript’s Triumph Hello World testing example, Selenese Command Programming Interface Hickey, Rich, JavaScript Tools You Should Know High Performance JavaScript (Zakas), The Power of JavaScript High Performance Web Sites (Souders), JavaScript Tools You Should Know higher order functions, Functional Programming hoisting, Lambda Functions Are Powerful <hr> tag, Accessibility Through WAI-ARIA, Accessibility Through WAI-ARIA, Accessibility Through WAI-ARIA HTML 5, Putting It All Together, Introduction to the Manifest File, Graphics, Web Worker Fractal Example, New Tags, New CSS, New Form Types, Canvas and SVG, New CSS Canvas, Graphics, Web Worker Fractal Example, Canvas and SVG manifest declaration example, Introduction to the Manifest File new CSS features, New CSS new form types, New Form Types new tags, New Tags, New CSS progress bar, Putting It All Together HTML5 Canvas (Fulton & Fulton), Graphics, Canvas and SVG HTML5 Graphics with SVG & CSS3 (Cagle), Canvas and SVG HTML5 Media (Powers), Audio and Video HTML5 Rocks tutorial, Canvas and SVG HTTP (Hypertext Transfer Protocol), Adding Power to Web Applications, Web Sockets, Erlang Yaws I I/O, Nonblocking I/O and Callbacks IDs, importance of assigning, Selenium if statement, Lambda Functions Are Powerful images, Functional Programming, Blobs, Working with Files, Drag-and-Drop, Filesystem, Filesystem, Debugging Manifest Files, Graphics, Graphics, Graphics, Web Worker Fractal Example, Canvas and SVG appending to documents, Working with Files and Canvas, Graphics editing, Filesystem, Graphics missing, Debugging Manifest Files progressive drawing, Web Worker Fractal Example scaling example, Functional Programming streaming video, Filesystem SVG, Canvas and SVG use of src attribute, Blobs, Graphics user access to, Drag-and-Drop <img> tag, Graphics, Accessibility Through WAI-ARIA importScripts() method, The Worker Environment independent event loops, Splitting Up Work Through Web Workers index() method, Adding Indexes IndexedDB, Adding Power to Web Applications, IndexedDB, Deleting Data indexes, adding/removing, Adding Indexes indexOf() method, Prototypes and How to Expand Objects info() method, Web Worker Fractal Example inner functions, Closures integration testing, Testing JavaScript Applications, Selenium interceptor methods, Expanding Functions with Prototypes Internet Explorer (IE), Microsoft, Array Iteration Operations, IndexedDB, A Pattern for Reuse of Multithread Processing iOS Selenium, testing applications for, Selenium RC and a Test Farm iPad/iPod/iPhone platform, Selenium RC and a Test Farm, A Pattern for Reuse of Multithread Processing isDuplicate() method, Deleting Data isElementPresent() method (Selenese API), Selenese Command Programming Interface isTextPresent() method (Selenese API), Selenese Command Programming Interface itemprop attribute, Microdata itemscope attribute, Microdata itemtype attribute, Microdata J JavaScript, JavaScript’s Triumph, JavaScript’s Triumph, Nonblocking I/O and Callbacks, Lambda Functions Are Powerful, Lambda Functions Are Powerful, Closures, Functional Programming, Functional Programming, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Currying and Object Parameters, Array Iteration Operations, You Can Extend Objects, Too, You Can Extend Objects, Too, Testing JavaScript Applications, Splitting Up Work Through Web Workers, Worker Communication, JavaScript Tools You Should Know, JavaScript Tools You Should Know, JavaScript Tools You Should Know array iteration operations, Array Iteration Operations, You Can Extend Objects, Too closures, Closures currying and object parameters, Currying and Object Parameters expanding functions, Expanding Functions with Prototypes, Expanding Functions with Prototypes expanding objects, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects extending objects, You Can Extend Objects, Too function statement and function expression, Lambda Functions Are Powerful functional programming in, Functional Programming, Functional Programming functions act as data in, Lambda Functions Are Powerful helpful tools for, JavaScript Tools You Should Know, JavaScript Tools You Should Know libraries, JavaScript’s Triumph nonblocking I/O and callbacks, Nonblocking I/O and Callbacks passing objects in Firefox, Worker Communication primitives in, Prototypes and How to Expand Objects prototypes, Prototypes and How to Expand Objects, Expanding Functions with Prototypes recent improvements in, JavaScript’s Triumph runtime event loop, Splitting Up Work Through Web Workers runtime model, Testing JavaScript Applications syntax checker, JavaScript Tools You Should Know JavaScript Patterns (Stefanov), The Power of JavaScript JavaScript: The Definitive Guide (Flanagan), The Power of JavaScript JavaScript: The Good Parts (Crockford), JavaScript’s Triumph, The Power of JavaScript, JavaScript Tools You Should Know jQuery, JavaScript’s Triumph, Functional Programming, DSt, jStore, IndexedDB, IndexedDB, Libraries for Web Workers DSt plug-in, DSt Hive extension, Libraries for Web Workers IndexedDB plug-in, IndexedDB, IndexedDB jStore plug-in, jStore library, JavaScript’s Triumph, Functional Programming jQuery Cookbook (Lindley), JavaScript’s Triumph JS2 mode, Emacs, JavaScript Tools You Should Know JSBeautifier, JavaScript Tools You Should Know JSLint, The Power of JavaScript, JavaScript Tools You Should Know JSMin, JavaScript Tools You Should Know JSON manifest file, Introduction to the Manifest File JsonStore object, Offline Loading with a Data Store jStore plug-in, jStore L Lambda Calculus, Lambda Functions Are Powerful lambda functions, Lambda Functions Are Powerful lastIndexOf(), Prototypes and How to Expand Objects libraries, JavaScript’s Triumph, Libraries for Web Workers Lindley, Cody, JavaScript’s Triumph Lisp lambdas, Lambda Functions Are Powerful list recursion, Functional Programming list test examples, Testing JavaScript Applications load() method (JSON), Offline Loading with a Data Store local data storage, Adding Power to Web Applications, Local Storage, jStore local state provider, ExtJS, Using localStorage in ExtJS localStorage object, The localStorage and sessionStorage Objects, Using localStorage in ExtJS, Storing Changes for a Later Server Sync location object, The Worker Environment loops, Array Iteration Operations, Selenium Commands, Splitting Up Work Through Web Workers, Splitting Up Work Through Web Workers, A Pattern for Reuse of Multithread Processing for, Array Iteration Operations independent event, Splitting Up Work Through Web Workers runtime event, Splitting Up Work Through Web Workers and Selenium, Selenium Commands while, A Pattern for Reuse of Multithread Processing M macros, recording web, Selenium Mandelbrot computation examples, Web Worker Fractal Example, Web Worker Fractal Example manifest file, Adding Power to Web Applications, Introduction to the Manifest File, Debugging Manifest Files map() method, Array Iteration Operations, You Can Extend Objects, Too match() method, Prototypes and How to Expand Objects McCarthy, John, Lambda Functions Are Powerful MD5 checksum, Updates to the Manifest File memory leaks, Selenium Commands <meter> tag, Tags for Applications microdata, Microdata Microsoft Internet Explorer, Array Iteration Operations, IndexedDB, A Pattern for Reuse of Multithread Processing minification, JavaScript Tools You Should Know MongoDB, IndexedDB mouseDown command (Selenium), Selenium Commands mouseOver command (Selenium), Selenium Commands mouseUp command (Selenium), Selenium Commands MozBlobBuilder, Blobs Mozilla Firefox, Prototypes and How to Expand Objects (see Firefox, Mozilla) mozSlice() method (Firefox), Blobs MozWebSockets, Web Sockets N name/value pairs, Currying and Object Parameters navigator object, The Worker Environment .NET/CLR, Web Socket Example NETWORK section, manifest, Structure of the Manifest File node trees, You Can Extend Objects, Too Node.js, Web Sockets, Web Socket Example, JavaScript Tools You Should Know nonblocking I/O, Nonblocking I/O and Callbacks :not() CSS selector, New CSS notDeepEqual() method, Testing with QUnit notEqual() method, Testing with QUnit notStrictEqual() method, Testing with QUnit noupdate events, Events :nth-child() CSS selector, New CSS number form input, New Form Types numbers, Lambda Functions Are Powerful, Prototypes and How to Expand Objects, Prototypes and How to Expand Objects, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Expanding Functions with Prototypes, Array Iteration Operations cubing example, Expanding Functions with Prototypes Fibonacci calculation examples, Expanding Functions with Prototypes, Expanding Functions with Prototypes as objects, Prototypes and How to Expand Objects squaring examples, Lambda Functions Are Powerful, Prototypes and How to Expand Objects, Array Iteration Operations O object parameters, Currying and Object Parameters object stores, IndexedDB, IndexedDB, Retrieving Data objects, extending, You Can Extend Objects, Too Offer-Aggregates specs, Microdata Offers specs, Microdata offline use, Local Storage, Offline Loading with a Data Store, Offline Loading with a Data Store, Storing Changes for a Later Server Sync, Introduction to the Manifest File, Debugging Manifest Files data access, Local Storage loading with data store, Offline Loading with a Data Store, Offline Loading with a Data Store manifest file, Introduction to the Manifest File, Debugging Manifest Files storing changes, Storing Changes for a Later Server Sync ok() method, Testing with QUnit onclose() method, The Web Sockets Interface onmessage() method, Using Web Workers, Web Worker Fractal Example, A Pattern for Reuse of Multithread Processing onopen() method, The Web Sockets Interface open command (Selenium), Selenium Commands Opera Dragonfly, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing Organizations specs, Microdata outer functions, Closures O’Reilly Answers website, The Power of JavaScript O’Sullivan, Bryan, Functional Programming P parameter blocks, Currying and Object Parameters path() method, You Can Extend Objects, Too pattern for reuse of multithread processing, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Payne, Alex, Functional Programming People specs, Microdata persistent local storage, Local Storage PhoneGap, Developing Web Applications PHP, Lambda Functions Are Powerful phpUnderControl, Selenese Command Programming Interface PHPUnit testing framework, Automatically Running Tests, Selenese Command Programming Interface pixel, drawing a, Web Worker Fractal Example PollenJS library, Libraries for Web Workers populate_form() method (DSt), DSt populating (example), Prototypes and How to Expand Objects port 443 (wss), Setting Up a Web Socket port 80 (ws), Setting Up a Web Socket port 8080, Web Socket Example $.post() method (Hive API), Libraries for Web Workers postMessage() method, Using Web Workers, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Powers, Shelley, Audio and Video PreloadStore object (JSON), Offline Loading with a Data Store pretty printer example, JavaScript Tools You Should Know primitives in JavaScript, Prototypes and How to Expand Objects Products specs, Microdata Programming Scala (Wampler & Payne), Functional Programming progress events, Events progress indicator examples, Putting It All Together, Tags for Applications <progress> tag, Tags for Applications prompt() method, Nonblocking I/O and Callbacks prototype object, Prototypes and How to Expand Objects prototypes, expanding functions with, Expanding Functions with Prototypes, Expanding Functions with Prototypes Q query access, IndexedDB QUnit, Testing JavaScript Applications, QUnit, Testing with QUnit, Running QUnit from Selenium R race conditions, IndexedDB, Splitting Up Work Through Web Workers raises() method, Testing with QUnit rar files, Drag-and-Drop RC server, Selenium, Selenium readAsArrayBuffer() method (FileReader), Working with Files readAsBinaryString() method (FileReader), Working with Files readAsText() method (FileReader), Working with Files readDataAsURL() method (FileReader), Working with Files Real World Haskell (Goerzen & Stewart), Functional Programming recall() method (DSt), DSt reduce(), reduceRight() methods, Array Iteration Operations refresh command (Selenium), Selenium Commands remove() method, Deleting Data replace() method, Prototypes and How to Expand Objects required attribute (forms), New Form Types Resig, John, JavaScript’s Triumph reuse of multithread processing, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing Review-Aggregates specs, Microdata Reviews specs, Microdata revokeBlobURL() method, Blobs Rhino, JavaScript Tools You Should Know role attribute, Accessibility Through WAI-ARIA route finder, Maps Ruby, Web Socket Example Ruby Event Machine, Ruby Event Machine run function example, A Pattern for Reuse of Multithread Processing run() method, Web Worker Fractal Example running average example, Array Iteration Operations runtime model, JavaScript, Testing JavaScript Applications S Safari Nightly builds, Blobs Safari, Apple’s, JavaScript’s Triumph, A Pattern for Reuse of Multithread Processing, Libraries for Web Workers, Web Sockets same origin policy, The localStorage and sessionStorage Objects, IndexedDB sandboxed environment, Developing Web Applications, Filesystem save queue examples, Storing Changes for a Later Server Sync Scala, Web Socket Example Scalable Vector Graphics, Canvas and SVG scaling images, Functional Programming scope, Lambda Functions Are Powerful, Closures <script> tag, The Worker Environment search form input, New Form Types Selenese, Selenium Commands, Selenese Command Programming Interface, Selenese Command Programming Interface Selenium, Testing JavaScript Applications, Selenium, Selenium, Selenium, Selenium Commands, Selenium Commands, Selenium Commands, Constructing Tests with the Selenium IDE, Constructing Tests with the Selenium IDE, Automatically Running Tests, Automatically Running Tests, Selenese Command Programming Interface, Selenese Command Programming Interface, Running QUnit from Selenium, Drag-and-Drop automatically running tests, Automatically Running Tests, Automatically Running Tests commands, Selenium Commands, Selenium Commands constructing tests, Constructing Tests with the Selenium IDE example tests, Selenium IDE, Selenium, Constructing Tests with the Selenium IDE location options, Selenium Commands no drag-and-drop, Drag-and-Drop running QUnit from, Running QUnit from Selenium Selenese, Selenese Command Programming Interface, Selenese Command Programming Interface test table, Selenium Selenium Grid, Automatically Running Tests Selenium RC server, Selenium, Selenium RC and a Test Farm self object, The Worker Environment Sencha ExtJS library, JavaScript’s Triumph send(“data”) method, The Web Sockets Interface server delay, Developing Web Applications, Web Sockets server polling, Web Sockets server-side testing, Testing JavaScript Applications, Testing JavaScript Applications, Selenese Command Programming Interface sessionStorage object, The localStorage and sessionStorage Objects, Using localStorage in ExtJS setInterval() method, Expanding Functions with Prototypes, The Worker Environment setTimeout() method, Expanding Functions with Prototypes, Testing with QUnit, The Worker Environment, A Pattern for Reuse of Multithread Processing, A Pattern for Reuse of Multithread Processing setVersion transaction, Adding Indexes side effects, Functional Programming single-step mode, Selenium sleep() method, Selenese Command Programming Interface slice() method, Prototypes and How to Expand Objects, Blobs slider, form, New Form Types smartphones, Developing Web Applications some() method, Array Iteration Operations Souders, Steve, JavaScript Tools You Should Know speech input type, New Form Types Speed Tracer, JavaScript Tools You Should Know speed, data storage and, Local Storage split() method, Prototypes and How to Expand Objects SQL Injection attacks, IndexedDB SQLite versus IndexedDB, IndexedDB squaring numbers example, Prototypes and How to Expand Objects src attribute, Audio and Video StackOverflow website, The Power of JavaScript startWorker() method, Web Worker Fractal Example static data storage, Local Storage Stefanov, Stoyan, The Power of JavaScript step through, Selenium, Testing and Debugging Web Workers Stewart, Donald Bruce, Functional Programming stock price examples, Web Socket Example, Ruby Event Machine stop() method, A Pattern for Reuse of Multithread Processing storage events, The localStorage and sessionStorage Objects storage viewer widget, The localStorage and sessionStorage Objects $.storage() method (Hive API), Libraries for Web Workers store() method (DSt), DSt store_form() method (DSt), DSt strictEqual() method, Testing with QUnit string token replacement, Prototypes and How to Expand Objects strings, methods for, Prototypes and How to Expand Objects Structure and Interpretation of Computer Programs (Abelson & Sussman), Functional Programming structured data, query access to, IndexedDB subclassing, Currying and Object Parameters Sussman, Gerald Jay, Functional Programming SVG, Canvas and SVG <svg> tag, Graphics Symfony Yaml Library, Updates to the Manifest File T tar files, Drag-and-Drop TCP socket, Web Socket Protocol TCP/IP sockets, Web Sockets tel form input, New Form Types test machines, Automatically Running Tests test suites, Testing JavaScript Applications, QUnit, Testing with QUnit, Selenium, Selenium RC and a Test Farm, Selenium, Selenium, Running QUnit from Selenium programming language based, Selenium QUnit, QUnit, Testing with QUnit, Selenium, Running QUnit from Selenium Selenium, Selenium, Selenium RC and a Test Farm server-side, Testing JavaScript Applications Test-driven development, Testing JavaScript Applications, Testing JavaScript Applications thread safety, Splitting Up Work Through Web Workers threads, Adding Power to Web Applications time form input, New Form Types title attribute, Accessibility Through WAI-ARIA transaction object, database, IndexedDB transaction.abort() method (jQuery), IndexedDB transaction.done() method (jQuery), IndexedDB True Type font files, New CSS type command (Selenium), Selenium Commands U undefined value, Functional Programming unit testing, Testing JavaScript Applications update() method (IndexedDB), Adding and Updating Records updateEach() method (IndexedDB), Adding and Updating Records uploading files, Uploading Files URLs, QUnit, Blobs, Working with Files, Structure of the Manifest File, Events, Events, Debugging Manifest Files, The Web Sockets Interface adding ?
Programming Scala: tackle multicore complexity on the JVM by Venkat Subramaniam
augmented reality, business logic, continuous integration, domain-specific language, don't repeat yourself, functional programming, higher-order functions, loose coupling, semantic web, type inference, web application
You can pass functions to functions as parameters, return them from functions, and even nest functions within functions. These higher-order functions are called function values. Once you get the hang of them, you’ll begin to structure your application around these function values as building blocks. You’ll quickly realize that they lead to concise, reusable code. Closures are special forms of function values that close over or bound to variables defined in another scope or context. In this chapter, you’ll learn how to use function values and closures in Scala. 6.1 Moving from Normal to Higher-Order Functions How would we find the sum of values in a given range 1 to number in Java?
…
Download at Boykma.Com CONTENTS 5 6 7 8 9 Sensible Typing 5.1 Collections and Type Inference . . . . 5.2 The Any Type . . . . . . . . . . . . . . 5.3 More About Nothing . . . . . . . . . . . 5.4 Option Type . . . . . . . . . . . . . . . 5.5 Method Return Type Inference . . . . 5.6 Passing Variable Arguments (Varargs) 5.7 Variance of Parameterized Type . . . . . . . . . . . . . . . . . . 63 64 66 67 68 69 70 71 . . . . . . . . . 75 75 76 78 80 81 83 84 87 88 . . . . . 91 91 94 95 97 99 . . . . . . . . . . 103 103 104 106 108 113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions . . . . . . . . . . . . . . . . . . . . . . . 116 116 117 118 119 120 121 121 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Values and Closures 6.1 Moving from Normal to Higher-Order Functions 6.2 Function Values . . . . . . . . . . . . . . . . . . . 6.3 Function Values with Multiple Parameters . . . 6.4 Currying . . . . . . . . . . . . . . . . . . . . . . . 6.5 Reusing Function Values . . . . . . . . . . . . . . 6.6 Positional Notation for Parameters . . . . . . . . 6.7 Execute Around Method Pattern . . . . . . . . . 6.8 Partially Applied Functions . . . . . . . . . . . . 6.9 Closures . . . . . . . . . . . . . . . . . . . . . . .
…
Download at Boykma.Com Prepared exclusively for sam kaplan F UNCTION VALUES In Scala, we’ll pass an anonymous function to the function that iterates over the range. So, we can pass different logic to achieve different tasks. Such functions that can take other functions as parameters are called higher-order functions. They reduce code duplication, increase reusability, and make your code concise as well. Let’s see how to create them in Scala. 6.2 Function Values In Scala, you can create functions within functions, assign them to references, and pass them around to other functions. Scala internally deals with these so-called function values by creating them as instances of special classes.
Programming in Scala by Martin Odersky, Lex Spoon, Bill Venners
domain-specific language, functional programming, Guido van Rossum, higher-order functions, Larry Wall, off-by-one error, Silicon Valley, sorting algorithm, the Cathedral and the Bazaar, type inference, web application
When you use a function value as an argument, the non-common part of the algorithm is itself some other algorithm! At each invocation of such a function, you can pass in a different function value as an argument, and the invoked function will, at times of its choosing, invoke the passed function value. These higher-order functions—functions that take functions as parameters—give you extra opportunities to condense and simplify code. One benefit of higher-order functions is they enable you to create control abstractions that allow you to reduce code duplication. For example, suppose you are writing a file browser, and you want to provide an API that allows users to search for files matching some criterion.
…
It is only because Scala supports closures that you were able to remove the query parameter from filesMatching in the most recent example, thereby simplifying the code even further. 9.2 Simplifying client code The previous example demonstrated that higher-order functions can help reduce code duplication as you implement an API. Another important use of higher-order functions is to put them in an API itself to make client code more concise. A good example is provided by the special-purpose looping methods of Scala’s collection types.1 Many of these are listed in Table 3.1 in Chapter 3, but take a look at just one example for now to see why these methods are so useful. 1 These special-purpose looping methods are defined in trait Iterable, which is extended by List, Set, Array, and Map.
…
In Java, such patterns would usually be expressed by idiomatic combinations of for or while loops. In Scala, they can be expressed more concisely and directly using higher-order operators,6 which are implemented as methods in class List. These higherorder operators are discussed in this section. 6 By higher-order operators, we mean higher-order functions used in operator notation. As mentioned in Section 9.1, higher-order functions are functions that take other functions as parameters. Cover · Overview · Contents · Discuss · Suggest · Glossary · Index 343 Section 16.7 Chapter 16 · Working with Lists Mapping over lists: map, flatMap and foreach The operation xs map f takes as operands a list xs of type List[T] and a function f of type T => U.
Haskell Programming: From First Principles by Christopher Allen, Julie Moronuki
book value, c2.com, en.wikipedia.org, fail fast, fizzbuzz, functional programming, heat death of the universe, higher-order functions, natural language processing, spaced repetition, tiling window manager, Turing complete, Turing machine, type inference, web application, Y Combinator
But what if x is 0? You may need to play with the compare function a bit to find what to do. nums x case LT GT 7.6 = compare x 0 of -> -1 -> 1 Higher-order functions Higher-order functions (HOFs) are functions that accept functions as arguments. Functions are just values — why couldn’t they be passed around like any other values? This is an important component of functional programming and gives us a way to combine functions efficiently. First let’s examine a simple higher-order function, flip: CHAPTER 7. MORE FUNCTIONAL PATTERNS 240 Prelude> :t flip flip :: (a -> b -> c) -> b -> a -> c Prelude> let sub = (-) Prelude> sub 10 1 9 Prelude> let rSub = flip sub Prelude> rSub 10 1 -9 Prelude> rSub 5 10 5 The implementation of flip is simple: flip :: (a -> b -> c) -> b -> a -> c flip f x y = f y x Alternately, it could’ve been written as: myFlip :: (a -> b -> c) -> b -> a -> c myFlip f = \ x y -> f y x There’s no semantic, or meaning, difference between flip and myFlip: one declares parameters in the function definition, and the other declares them instead in the anonymous function value being returned.
…
You’ll see a lot of this in our chapter on non-strictness later on. 6. Higher-order functions are functions which themselves take functions as arguments or return functions as results. Due to currying, technically any function that appears to take more than one argument is higher order in Haskell. CHAPTER 7. MORE FUNCTIONAL PATTERNS 267 -- Technically higher order -- because of currying Int -> Int -> Int -- See? Returns another function -- after applying the first argument Int -> (Int -> Int) -- The rest of the following examples are -- types of higher order functions (a -> b) -> a -> b (a -> b) -> [a] -> [b] (Int -> Bool) -> [Int] -> [Bool] -- also higher order, this one -- takes a function argument which itself -- is higher order as well.
…
Parsers analyze structure in conformance with rules specified in a grammar, whether it’s a grammar of a human language, a programming language, or a format such as JSON. A parser combinator is a higher-order function that takes parsers as input and returns a new parser as output. You may remember our brief discussion of combinators way back in the lambda calculus chapter. Combinators are expressions with no free variables. CHAPTER 24. PARSER COMBINATORS 843 The standard for what constitutes a “combinator” with respect to parser combinators is a little looser. Parsers are functions, so parser combinators are higher-order functions that can take parsers as arguments. Usually the argument passing is elided because the interface of parsers will often be like the State monad which permits Reader-style implicit argument passing.
Programming Scala by Unknown
billion-dollar mistake, business logic, domain-specific language, duck typing, en.wikipedia.org, fault tolerance, functional programming, general-purpose programming language, higher-order functions, information security, loose coupling, type inference, web application
You can return functions as values from functions. In the functional paradigm, functions become a primitive type, a building block that’s just as essential to the work of programming as integers or strings. When a function takes other functions as arguments or returns a function, it is called a higher-order function. In mathematics, two examples of higher-order functions from calculus are derivation and integration. Variables that Aren’t The word “variable” takes on a new meaning in functional programming. If you come from a procedural or object-oriented programming background, you are accustomed to variables that are mutable. In functional programming, variables are immutable.
…
The common data structures support the same subset of higher-order functions for read-only traversal and access to the elements in the data structures. These features make them suitable as “protocols” for minimizing the coupling between components, while supporting data exchange. 172 | Chapter 8: Functional Programming in Scala Download at WoweBook.Com In fact, these data structures and their operations are so useful that many languages support them, including those that are not considered functional languages, like Java and Ruby. Java doesn’t support higher-order functions directly. Instead, function values have to be wrapped in objects.
…
It is the combination of referentially transparent functions and immutable values that make functional programming compelling as a better way to write concurrent software. These qualities benefit programs in other ways. Almost all the constructs we have invented in 60-odd years of computer programming have been attempts to manage complexity. Higher-order functions and referential transparency provide very flexible building blocks for composing programs. Immutability greatly reduces regression bugs, many of which are caused by unintended state changes in one part of a program due to intended changes in another part. There are other contributors to such non-local effects, but mutability is one of the most important.
Practical OCaml by Joshua B. Smith
cellular automata, Debian, domain-specific language, duck typing, Free Software Foundation, functional programming, general-purpose programming language, Grace Hopper, higher-order functions, hiring and firing, John Conway, Paul Graham, slashdot, SpamAssassin, text mining, Turing complete, type inference, web application, Y2K
The compiler will give you errors if the inferred type is incompatible with the specified type: # let mismatching (x:int) (y: float) = x + (int_of_string y);; Characters 56-57: let mismatching (x:int) (y: float) = x + (int_of_string y);; ^ This expression has type float but is here used with type string # Using Higher-Order Functions OCaml has support for higher-order functions (HOFs), which take other functions as arguments. OCaml can do this because functions are first-class types. For example, the following (somewhat contrived) example is a function that takes three arguments. The first argument is a function that takes two arguments; the other two arguments are then passed as arguments to the first argument.
…
See anonymous functions generics, 160, 162 Genlex module, 415 get methods, arrays and, 97 GODI (Great Outdoors Digital Indoors), 12, 434 GODI packages, 402 Graham, Paul, 169, 266 graphical user interface (GUI) applications, concurrency and, 310 Graphics module, 390, 397, 399 graphs, 347 GraphViz utility, 145, 347 Great Outdoors Digital Indoors (GODI), 12, 402, 434 guard function, 321 guards, 48 GUI (graphical user interface) applications, concurrency and, 310 ■H hashtables, 51, 100–103 Hashtbl module, 51 Haskell programming language, 253, 263, 266 header files, 159, 350 Hello World program, 17 hex dumps, 376 high-level functions, 122, 305 higher-order functions (HOFs), 36–41 history functions, 357 HOFs (higher-order functions), 36–41 Hormel Corporation, 169, 178 HTML, ocamldoc output and, 146 http clients, creating, 120 HTTP GET request, 293 HTTP protocol, Shoutcast protocol and, 293 Hughes, John, 266, 270 ■I -i compiler flag, 406 -I <DIR> compiler flag, 406 -impl FILENAME compiler flag, 405 -intf FILENAME compiler flag, 405 I/O (input/output) operations, 113–122 binary files and, 376 purity and, 251 I/O functions, 113 I/O overlap, concurrency and, 309 Icecast protocol, 293 ID function, 316 ID3 tags, 295–300 IDEs (integrated development environments), 14 IDL (Interface Definition Language), 2, 355 III#install printer directive, 80 images, bitmap files and, 383–389 immediate objects, 231 immutability, 249 imperative data structures, 252 imperative programming, 30, 249, 253, 262 import functions, writing, 84 impurity, OCaml and, 254–260 in_channel functions, 114 in_channel_length function, 114 increment function, 172 infix functions, 34, 42 information leaks, 254–260 info_messages function, 301 inheritance, 228, 236–243 vs. composition, 238 multiple, 239 init function, arrays and, 97 initializers, 226, 232 input channels, 52, 114 input function, 114 input, lexing and, 193 input/output (I/O) operations 113–122 binary files and, 376 purity and, 251 input_char function, 114 input_line function, 78, 114 INRIA (Institut National de Recherche en Informatique et en Automatique), 4, 12, 15, 433 int32 integer, 62 Int32_val(v) function, 352 Find it faster at http://superindex.apress.com/ exceptions and, 123 Foreign Function Interfaces and, 349 high-level, 122 higher-order, 36–41 I/O, 113 implementing your own, 350 infix, 34, 42 low-level, 120 in OCaml vs. other languages, 38 prefix, 34 recursive, 44 socket, 120 functions (subsections, in structured programming), 262 functor keyword, 160 functors, 106, 111, 155–168 creating modules and, 160 currying, 163 understanding, 160–166 when to use, 162 449 620Xidxfinal.qxd 450 9/22/06 4:19 PM Page 450 ■INDEX int64 integer, 62 Int64_val(v) function, 352 int_of_distance function, 42 int_of_float function, 32 Int_val(val) function, 351 integers, 16, 24, 29, 62 integrated development environments (IDEs), 14 Intellisense, 14 Interface Definition Language (IDL), 2, 355 interfaces, 158 interfacing with OCaml, 349–358 internal classes, 233 interthread communication, 309, 319 Invalid_argument exception, 98, 331, 352 Invalid_argument of string exception, 126 IPC mechanism, 275, 319 Is_block(x) function, 351 Is_long(x) function, 351 is_relative function, 137 iter function, 93 hashtables and, 102 lists and, 93 ■J Jambon, Martin, 79 Java, 25, 26 Javadoc, 145 join function, 311, 317 ■K kill function, 316 kprintf function, 76 kscanf function, 77 ■L labeled variants, 111 labels, 49, 237 labltk, 167 Lambda Calculus, 263 LaTeX, ocamldoc output and, 147 lazy evaluation of data, 67, 266 Ledit, 15, 404 length function, 91, 97 hashtables and, 101 queues and, 104 stacks and, 106 Leroy, Xavier, 3 Lesser General Public License (LGPL), 11 let bindings, 22, 34, 47 let keyword, 30, 33, 412 levels, 420 Levenshtein distance, 243–248 Lex (Lexical Analyzer Generator), 193 lex_curr_pos, 196 lex_eof_reached, 196 lexbuf, 196, 198 lexers, 206 log file example and, 214, 217 reasons for using, 194 Lexical Analyzer Generator (Lex), 193 lexing, 193–202 lexing buffers, 197 Lexing.lexeme functions, 197, 200 LGPL (Lesser General Public License), 11 libraries, 29 Findlib and, 167, 311, 409 vs. modules, 155 library directory, 167 line numbers, obtaining, 134 line-oriented I/O, 78 __LINE__ preprocessor directive (C language), 134 link_harvest class, 338 -linkall compiler flag, 406 links, 118 Linux, installing OCaml and, 14 Lisp, 169 263 list folding, 39 List module, 155 List.hd function, 92 List.map function, 155 List.rev function, 92 List.sort function, 37 List.tl function, 92 LIST0 keyword, 423 LIST1 keyword, 423 lists, 37, 66, 91–96 creating, 96 head/tail of, 92 purely functional data structures and, 252 reversed, 92 syntax extensions and, 423 load function, for securities trades database, 56 lock function, 317 locking files, 118 log file analysis, parsers and, 203 log files, 213–223 Logging library, 365–374 low-level functions, 120 ■M mailing lists, 433 mainloop function, 333, 338, 341, 343 maintenance programming, 125, 132 make function, 97 make libinstall, 167 -make-runtime flag, 350, 407 Make_wizard, 167 620Xidxfinal.qxd 9/22/06 4:19 PM Page 451 ■INDEX opening, 52 private, 157 for threads, 316–322 mod_caml library, 276, 289–291 mod_ocaml library, 276 monadic computation, 251 monads, 254 Mottl, Markus, 175, 285, 401 MP3 files, 293, 295 multi-CPU environments, concurrency and, 310 multipart file downloads, 278 multiple inheritance, 239 mutable keyword, 28 mutable references, 21, 23 Mutex module, 317 mutexes, 301, 312–316, 317 myprog executable, 350 ■N name clashes modules and, 155, 168 records and, 29 namespaces, vs. modules, 155 naming conventions for modules, 156 for functions, 350 nan (Not A Number) condition, 172 nativeints, 62 Nativeint_val(v) function, 352 Naur, Peter, 210 Netstring library, URI module and, 135 network-aware sample scoring function, 179–191 news groups, 434 new_channel function, 320 next function, 413 -noassert flag, 133, 407 -noautolink flag, 407 -nolabels flag, 407 non-LISPy programming languages, 254 Not A Number (nan) condition, 172 Not_found exception, 94, 101, 126, 331 Noweb, 145 Nullsoft’s Shoutcast, 293 ’\<NUMBER>’, 64 ■O .o files, 408 -o OUTPUTFILE compiler flag, 405 object keyword, 226, 228 object polymorphism, 26 object system of OCaml, 225–248 object-oriented programming (OOP), 262 Find it faster at http://superindex.apress.com/ Makefiles, 371, 401, 405, 409 compiling spam filter code and, 175 log files code and, 222 Shoutcast server and, 304 Makefile wizard, 409 makeserversocket function, 301 malloc data, 352 map function, 39, 109, 155 lists and, 93 strings and, 377 Map functor 136, 333 Map.Make functor, 171 MapReduce concept, 263 maps, 109 Marshal module, 41, 51 match keyword, 126 matched_group function, 331 matched_string function, 331 Match_failure exception, 126 matrices, 97–100 max_int size, 120 mem function, 94 mem_assoc function, 95 merge function, 96 META files, 167, 371 meta language (ML), 155, 253, 263 lazy evaluation and, 266 OCaml evolution and, 3 metadata, Shoutcast and, 293 Meter type, 42 methods, 225, 227 polymorphism and, 229 virtual, 234 Meyer, Bertrand, 133 Micmatch library, 79 Milner, Robin, 3 minder function, 301, 322 Miranda programming language, 263 ML (meta language), 155, 253, 263 lazy evaluation and, 266 OCaml evolution and, 3 .ml files/.mli files, 18, 20, 153 URI signature and, 135 comments and, 148 module compilations and, 408 .mll files, processed by ocamllex, 197–201 modf function, 64 modularity, 270 module keyword, 156 modules, 155–168, 225, 399 creating, 156, 160 dependencies and, 166 Hashtbl, 51 installing, 167 Marshal, 51 multiple views of, 159 451 620Xidxfinal.qxd 452 9/22/06 4:19 PM Page 452 ■INDEX objects, 225–229 vs. classes, 226 cloning, 241 direct, 231 functional, 241 parameterized, 234 reasons for using, 227 OCaml background of, 3 distributions, 12 extending syntax and, 411, 416, 420–428 impurity and, 254–260 installing, 12–18 interfacing with, 349–358 licensing, 11 object system and, 225–48 purity and, 249–260 reasons for using, 1 source code for, 12 web site for, 3 ocaml command, 15 OCaml community web site, 3 OCaml compilers, 405 OCaml debugger (ocamldebug), 404 OCaml development tools, 401–410 OCaml interpreter.
…
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 ■CHAPTER 3 Syntax and Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Variables in a Constant Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 What Variables Are Not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Let Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Understanding Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 620Xfmfinal.qxd 9/22/06 4:21 PM Page ix ■CONTENTS Records and Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Creating Enums and Simple User-Defined Types . . . . . . . . . . . . . . . 26 Defining Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 More About Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Integers and Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Others . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Defining Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Imperative Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Signatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 ■CHAPTER 4 Understanding Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Creating Values and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Functions Must Have One Return Type . . . . . . . . . . . . . . . . . . . . . . . . 35 Constraining Types in Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Using Higher-Order Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Using Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Why Use Anonymous Functions?
Programming in Lua, Fourth Edition by Roberto Ierusalimschy
combinatorial explosion, domain-specific language, Donald Knuth, functional programming, higher-order functions, Internet of things
A function that takes another function as an argument, such as sort, is what we call a higher-order function. Higher-order functions are a powerful programming mechanism, and the use of anonymous functions to create their function arguments is a great source of flexibility. Nevertheless, remember that higher-order functions have no special rights; they are a direct consequence of the fact that Lua handles functions as first-class values. To further illustrate the use of higher-order functions, we will write a naive implementation of a common higher-order function, the derivative. In an informal definition, the derivative of a function f is the function f’(x) = (f(x + d) - f(x)) / d when d becomes infinitesimally small.
…
Technically speaking, what is a value in Lua is the closure, not the function. The function itself is a kind of a prototype for closures. Nevertheless, we will continue to use the term “function” to refer to a closure whenever there is no possibility for confusion. Closures provide a valuable tool in many contexts. As we have seen, they are useful as arguments to higher-order functions such as sort. Closures are valuable for functions that build other functions too, like our newCounter example or the derivative example; this mechanism allows Lua programs to incorporate sophisticated programming techniques from the functional world. Closures are useful for callback functions, too.
…
Given that a geometric region is a set of points, we can represent a region by its characteristic function; that is, we represent a region by a function that, given a point, returns true if and only if the point belongs to the region. As an example, the next function represents a disk (a circular region) with center (1.0, 3.0) and radius 4.5: function disk1 (x, y) return (x - 1.0)^2 + (y - 3.0)^2 <= 4.5^2 end With higher-order functions and lexical scoping, it is easy to define a disk factory, which creates disks with given centers and radius: function disk (cx, cy, r) return function (x, y) return (x - cx)^2 + (y - cy)^2 <= r^2 end end A call like disk(1.0, 3.0, 4.5) will create a disk equal to disk1. The next function creates axis-aligned rectangles, given the bounds: function rect (left, right, bottom, up) return function (x, y) return left <= x and x <= right and bottom <= x and x <= up end end In a similar fashion, we can define functions to create other basic shapes, such as triangles and non–axis-aligned rectangles.
Monadic Design Patterns for the Web by L.G. Meredith
barriers to entry, domain-specific language, don't repeat yourself, finite state, functional programming, Georg Cantor, ghettoisation, higher-order functions, John von Neumann, Kickstarter, semantic web, seminal paper, social graph, type inference, web application, WebSocket
In terms of the code above, we only really need to interpret this much of what’s going: Cover · Overview · Contents · Discuss · Suggest · Glossary · Index 66 Section 3.4 Chapter 3 · An I/O Monad for HTTP Streams trait MonadicGenerators { self : WireTap with Journalist => trait Generable[+A,-B,+C] { def funK : (A => (B @suspendable)) => (C @suspendable) def foreach( f : (A => B @suspendable) ) : C @suspendable = { funK( f ) } ... } case classssGenerator[+A,,,-B,+C] ( override val funK : (A => (B @suspendable)) => (C @suspendable) ) extend Generable[A,B C] { ... } ... } A Generator is expecting a higher-order function that plays well with delimited continuations. The foreach method merely takes a function as argument and passes it to the higher-order function contained in the Generator. Thus, the method show will bind k to ( s : String ) => { println( s ) } and the implementation of foreach will cause this to be invoked on t. Download from Wow! eBook <www.wowebook.com> object MG extends MooonadicGenerators with WireTap with J urnalist { ... defffshow( t : Strrring) = { or( s <- Gene ator { k : ( String => Unit @suspendable ) => { k( t ) } } ) { println( s ) } } } Running this code we see: scala> reset{ MG.show( "yo!"
…
Yet, functional programming does not embrace concurrency and distribution in its foundations. It is not based on a computation model, like the actor model or the process calculi, in which the notion of execution is fundamentally concurrent. That said, it meshes nicely with various concurrency programming models. In particular, the combination of higher-order functions (with the ability to pass functions as arguments and return functions as values) together with a monad’s structuring techniques make models, such as software transactional memory or data flow parallelism, quite easy to integrate. In addition, pattern-matching makes the message-passing style easier to incorporate.
…
Given an inhabitant, a of the argument type, A, we make a KCtxt that takes a function, k, from A to R and applies it to a. Similarly, the implementation of bind almost writes itself from the type. We know that we have to return a KCtxt[R,B] which means we have to pass in to its constructor a higher-order function, say k, taking a B to an R. In other words, just from the return type alone we know that the body of the method definition has to look something like: KCtxt[R,B]( ( k : B => R ) => { ... } ) Now, we know that body of the closure passed in to the constructor has to return an R. How to make one?
Masterminds of Programming: Conversations With the Creators of Major Programming Languages by Federico Biancuzzi, Shane Warden
Benevolent Dictator For Life (BDFL), business intelligence, business logic, business process, cellular automata, cloud computing, cognitive load, commoditize, complexity theory, conceptual framework, continuous integration, data acquisition, Dennis Ritchie, domain-specific language, Douglas Hofstadter, Fellow of the Royal Society, finite state, Firefox, follow your passion, Frank Gehry, functional programming, general-purpose programming language, Guido van Rossum, higher-order functions, history of Unix, HyperCard, industrial research laboratory, information retrieval, information security, iterative process, Ivan Sutherland, John von Neumann, Ken Thompson, Larry Ellison, Larry Wall, linear programming, loose coupling, machine readable, machine translation, Mars Rover, millennium bug, Multics, NP-complete, Paul Graham, performance metric, Perl 6, QWERTY keyboard, RAND corporation, randomized controlled trial, Renaissance Technologies, Ruby on Rails, Sapir-Whorf hypothesis, seminal paper, Silicon Valley, slashdot, software as a service, software patent, sorting algorithm, SQL injection, Steve Jobs, traveling salesman, Turing complete, type inference, Valgrind, Von Neumann architecture, web application
I think lightweight type systems are also very important—whether they’re the purely dynamic type systems of Scheme and Erlang, or the polymorphic inference-based systems of Haskell and ML. Both are lightweight in the sense that the types don’t get in your way, even when you make heavy use of higher-order functions—and that’s really at the heart of functional programming. I think lazy evaluation is also important, but of course it’s not found in every functional language. Paul: Abstraction, abstraction, and abstraction—which, for me, includes higher-order functions, monads (an abstraction of control), various type abstractions, and so on. What are the advantages of writing in a language without side effects? Simon: You only have to reason about values and not about state.
…
Robin: Having explained ML’s role (as a host to logics) I suppose the closest question to this one that I can answer is this: can other languages be equally good hosts to logics for proof? I’m sure they can, if they have a rich and flexible type system and handle both higher-order functions and imperative features. ML was fortunate to be the host chosen by some successful logic developers, and this means that people continue to choose it. Why are higher-order functions necessary for a language to be a good host for what you call logics of proof? Robin: You implement inference rules as functions from theorems to theorems. So that’s the first-order type. Your theorems are essentially sentences, so an inference rule is essentially a function from strings to strings.
…
One of them we already have, which is the ability to pass code as parameters. As APIs get more and more complex in their capabilities, you can’t just pass in flat values or data structures to the API. You’ve got to pass in pieces of code that the API then orchestrates and executes. You need higher-order functions and abstractions such as map, fold, and reduce. Anders: Higher-order functions. Exactly. In order to be able to do that, you need stuff like lambdas and closures and so on. In order for you to be able to do that in a concurrent environment, you also need guarantees on whether these lambdas are pure, or do they have side effects.
Higher-Order Perl: A Guide to Program Transformation by Mark Jason Dominus
always be closing, Defenestration of Prague, digital rights, Donald Knuth, functional programming, higher-order functions, Isaac Newton, Larry Wall, P = NP, Paul Graham, Perl 6, slashdot, SpamAssassin
The code is also easier to understand this way: Now the promise says explicitly that the function will be calling itself on the tails of the two streams. These curried functions are examples of higher-order functions. Ordinary functions operate on values: You put some values in, and you get some other values out. Higher-order functions are functions that operate on other functions: You put some functions in, and you get some other functions out. For example, in combine2() we put in a function to operate on two scalars and we got out an analogous function to operate on two streams. 7.2 Common Higher-Order Functions Probably the two most fundamental higher-order functions for any list or other kind of sequence are analogs of map() and grep(). map() and grep() are higherorder functions because each of them takes an argument that is itself another function.
…
Changing one line in the source code causes a ripple effect that propagates all the way to the final result: my @fact = (Math::BigRat->new(1)); sub factorial { my $n = shift; return $fact[$n] if defined $fact[$n]; $fact[$n] = $n * factorial($n-1); } The output is now: 0 1 0 1/3 0 2/15 0 17/315 0 62/2835 7. Higher-Order Functions and Currying Our memoize() function of Chapter 3 was a “function factory,” building stub functions that served as replacements for other functions. The technique of using functions to build other functions is extremely powerful. In this chapter, we’ll look at a technique called currying, which transforms an ordinary function into a function factory for manufacturing more functions, and at other techniques for transforming one function into another. A higher-order function is a function that operates on other functions instead of on data values.
…
While discussing caching techniques in Chapter 3, Mark Jason Dominus points out how a large enough increase in power can change the fundamental way you think about a technology. And that’s precisely what this entire book does for Perl. It raids the deepest vaults and highest towers of Computer Science, and transforms the many arcane treasures it finds —recursion, iterators, filters, memoization, partitioning, numerical methods, higher-order functions, currying, cutsorting, grammar-based parsing, lazy evaluation, and constraint programming — into powerful and practical tools for real-world programming tasks: file system interactions, HTML processing, database access, web spidering, typesetting, mail processing, home finance, text outlining, and diagram generation.
Think OCaml by Nicholas Monje, Allen Downey
en.wikipedia.org, Free Software Foundation, functional programming, higher-order functions, random walk
You can also use a variable as an argument: >>> michael = 1 >>> print_twice michael 1 1 - : unit = () The name of the variable we pass as an argument (michael) has nothing to do with the name of the parameter (bruce). It doesn’t matter what the value was called back home (in the caller); here in print_twice, we call everybody bruce. 26 Chapter 3. Functions Functions can also take other functions as arguments. Such a function is called a Higher-Order Function, which is sometimes abbreviated HOF. 3.8 Functions are Just Renamed Expressions In OCaml, functions are really just expressions renamed. This means that an Ocaml function must evaluate to a value, hence why you must use sequence points within a function definition. Using let within a function definition requires the in keyword: let cat_twice part1 part2 = let cat = part1ˆpart2ˆ"\n" in catˆcat;; This function takes two string arguments, concatenates them and adds a newline character, and then concatenates the result to itself and returns this string.
…
In general, it’s always a good idea to see if somebody has already coded solutions relating to your problem, but for pedagogy’s sake, don’t do that right now. We’ll talk about some of those built-ins later. OCaml provides a few useful built-in functions to help with list sorting. The most useful of these is, unsurprisingly, List.sort. This is an example of a higher-order function: it takes two arguments, a function to use to determine the sort order, and the list itself. 1 The sorting function must take two arguments of the same type, whatever the type of the list to be sorted is (or polymorphic), and it must return a positive integer if the first element comes after the second element, zero if they are equal, and a negative integer if the first element comes first.
…
., 4 Currying, 27 data structure, 94, 109 debugging, 4, 8, 9, 17, 28, 41, 53, 60, 84, 94, 109 by bisection, 47 emotional response, 8 experimental, 5 declaration, 85 default value, 106, 110 definition function, 22 recursive, 95 deterministic, 101, 110 development plan random walk programming, 110 diagram stack, 26 state, 12 dictionary lookup, 81 looping with, 80 reverse lookup, 81 Index Directive, 2 divisibility, 31 documentation, 10 dot notation, 29 Doyle, Arthur Conan, 5 Doyle, Sir Arthur Conan, 103 DSU pattern, 94 duplicate, 61, 85 element, 55, 60 emotional debugging, 8 empty list, 55 empty string, 53 encapsulation, 46 encryption, 84 epsilon, 46 error runtime, 4, 17, 39 semantic, 4, 12, 17 syntax, 4, 17 error message, 4, 8, 12, 17 escape character, 7 Euclid’s algorithm, 43 evaluate, 14 exception, 4, 9, 17 IndexError, 50 RuntimeError, 39 SyntaxError, 22 TypeError, 49 ValueError, 88 executable, 2, 9 experimental debugging, 5, 110 expression, 13, 14, 19 boolean, 31, 35 Fermat’s Last Theorem, 36 fibonacci function, 82 filter pattern, 60 find function, 51 flag, 85 float type, 11 floating-point, 18, 46 flow of execution, 24, 29 For loop, 70 for loop, 57 formal language, 5, 9 frame, 26 frequency, 79 letter, 94 word, 101, 111 function, 22, 28 113 ack, 42 fibonacci, 82 find, 51 log, 21 randint, 61 recursive, 37 sqrt, 22 String.length, 50 zip, 88 function argument, 25 function call, 21, 29 function definition, 22, 24, 29 function frame, 26 function parameter, 25 function, math, 21 function, reasons for, 28 function, trigonometric, 21 function, tuple as return value, 88 Functional Programming, 7 Functions Anonymous, 59 Currying, 27 gather, 94 GCD (greatest common divisor), 43 global variable, 85 greatest common divisor (GCD), 43 Guarded Patterns, 35 hash function, 85 hashtable, 77, 78, 84, 85 hashtbale subtraction, 106 header, 23, 29 Hello, World, 7 high-level language, 1, 8 Higher-Order Functions, 25 histogram, 79, 85 random choice, 102, 107 word frequencies, 102 HOF, 25 Holmes, Sherlock, 5 homophone, 86 if statement, 32 immutability, 53 implementation, 79, 85, 109 in, 15 index, 49, 53, 56, 77 starting at zero, 49 IndexError, 50 infinite recursion, 39, 42 114 int type, 11 integer, 18 long, 83 interactive mode, 2, 9 interlocking words, 61 interpret, 1, 8 invocation, 53 item, 53, 55 hashtable, 84 item update, 58 key, 77, 84 key-value pair, 77, 84 keyboard input, 33 keyword, 13, 19 labelled parameter, 104 language formal, 5 high-level, 1 low-level, 1 natural, 5 programming, 1 safe, 4 let, 15 letter frequency, 94 letter rotation, 53, 85 Linux, 5 list, 55, 60 concatenation, 56 element, 56 empty, 55 nested, 55 of tuples, 89 operation, 56 traversal, 57, 60 literalness, 6 local variable, 26, 29 log function, 21 logarithm, 111 logical operator, 31, 32 long integer, 83 lookup, 85 lookup, dictionary, 81 loop for, 57 Looping, 70 looping with dictionaries, 80 low-level language, 1, 8 map pattern, 60 Index mapping, 108 Markov analysis, 107 mash-up, 108 math function, 21 McCloskey, Robert, 51 membership binary search, 61 bisection search, 61 hashtable, 78 set, 78 memo, 82, 85 metathesis, 94 method, 53 string, 53 module, 7, 29 pprint, 84 random, 61, 102 string, 101 modulus operator, 31, 35 natural language, 5, 9 nested conditional, 33, 35 nested list, 55, 60 Newton’s method, 45 not operator, 32 number, random, 101 object code, 2, 9 operand, 13, 19 operator, 13, 19 and, 32 bracket, 49 cons, 55 logical, 31, 32 modulus, 31, 35 not, 32 or, 32 overloading, 16 relational, 32 string, 16 operator, arithmetic, 13 optional parameter, 104 or operator, 32 order of operations, 16, 18 override, 110 palindrome, 42 parameter, 25, 26, 29 labelled, 104 optional, 104 parentheses empty, 23 Index matching, 4 overriding precedence, 16 parameters in, 25 tuples in, 87 parse, 6, 9 Partial Application, 27 pattern filter, 60 map, 60 reduce, 60 search, 52, 53 swap, 87 Pattern Matching, 34 Pattern-Matching Guarded, 35 PEMDAS, 16 pi, 48 plain text, 101 poetry, 6 portability, 1, 8 pprint module, 84 precedence, 19 precondition, 61 prefix, 108 pretty print, 84 print statement, 7, 9 problem solving, 1, 8 program, 3, 9 Programming Functional, 7 programming language, 1 Programming Paradigms, 7 Functional, 7 Object-Oriented, 7 Project Gutenberg, 101 prompt, 2, 9, 34 prose, 6 pseudorandom, 101, 110 Puzzler, 85, 95 quotation mark, 7, 11 radian, 21 Ramanujan, Srinivasa, 48 randint function, 61 random function, 102 random module, 61, 102 random number, 101 random text, 108 random walk programming, 110 Read functions, 33 115 Recursion Tail-end, 40 recursion, 37, 42 infinite, 39 traversal, 50 recursive definition, 95 reduce pattern, 60 reducible word, 86, 95 redundancy, 6 References, 15, 69 relational operator, 32 return value, 21, 29 tuple, 88 reverse lookup, dictionary, 81 reverse lookup, hashtable, 85 reverse word pair, 61 rotation letters, 85 rotation, letter, 53 RSA algorithm, 84 rules of precedence, 16, 19 running pace, 19 runtime error, 4, 17, 39 RuntimeError, 39 safe language, 4 sanity check, 84 scaffolding, 84 scatter, 94 Scope, 15 scope, 15 Scrabble, 94 script, 2, 9 script mode, 2, 9 search pattern, 52, 53 search, binary, 61 search, bisection, 61 semantic error, 4, 9, 12, 17 semantics, 4, 9 sequence, 49, 53, 55, 87 set anagram, 94 set membership, 78 shape, 94 sine function, 21 slice, 53 source code, 2, 8 sqrt function, 22 square root, 45 stack diagram, 26 state diagram, 12, 18 116 statement, 18 assignment, 12 conditional, 32, 35 for, 57 if, 32 print, 7, 9 Strictly typed, 14 string, 11, 18 comparison, 52 operation, 16 string method, 53 String module, 50 string module, 101 string type, 11 String.length function, 50 structure, 6 subexpressions, 14 subtraction hashtable, 106 with borrowing, 46 suffix, 108 swap pattern, 87 syntax, 4, 9 syntax error, 4, 9, 17 SyntaxError, 22 Tail-end Recursion, 40 tail-end recursion, 42 testing interactive mode, 2 text plain, 101 random, 108 token, 6, 9 Toplevel, 2 toplevel, 9 traceback, 39, 41 traversal, 50, 52, 53, 80, 89, 103 list, 57 triangle, 36 trigonometric function, 21 tuple, 87, 88, 94 assignment, 87 comparison, 89 tuple assignment, 88, 89, 94 type, 11, 18 char, 11 float, 11 hashtable, 77 int, 11 list, 55 Index long, 83 str, 11 tuple, 87 unit, 12, 23 TypeError, 49 typographical error, 110 underscore character, 13 uniqueness, 61 unit type, 12, 18, 23 update histogram, 103 item, 58 use before def, 17 User input, 33 value, 11, 18, 85 default, 106 tuple, 88 ValueError, 88 variable, 12, 18 local, 26 Variables References, 15 While loop, 70 word frequency, 101, 111 word list, 78 word, reducible, 86, 95 words.txt, 78 zero, index starting at, 49 zip function, 88 Zipf’s law, 111
Programming Clojure by Stuart Halloway, Aaron Bedra
continuous integration, duck typing, en.wikipedia.org, functional programming, general-purpose programming language, Gödel, Escher, Bach, higher-order functions, Neal Stephenson, Paul Graham, Ruby on Rails, type inference, web application
Here is a similar implementation in Clojure: src/examples/introduction.clj (defn blank? [str] (every? #(Character/isWhitespace %) str)) The Clojure version is shorter. But even more important, it is simpler: it has no variables, no mutable state, and no branches. This is possible thanks to higher-order functions. A higher-order function is a function that takes functions as arguments and/or returns functions as results. The every? function takes a function and a collection as its arguments and returns true if that function returns true for every item in the collection. Because the Clojure version has no branches, it is easier to read and test.
…
They take a map argument and look themselves up in the map. Having switched to keyword keys for the inventors, you can look up an inventor by calling the map or by calling a key: (inventors :Clojure) -> "Hickey" (:Clojure inventors) -> "Hickey" This flexibility in ordering comes in handy when calling higher-order functions, such as the reference and agent APIs in Chapter 5, State. If several maps have keys in common, you can document (and enforce) this fact by creating a record with defrecord: (defrecord name [arguments]) The argument names are converted to keys that have the values passed in when creating the record.
…
These special cases add branches and exits to the method. With a functional approach, most of these kinds of special cases just work without any explicit code. The imperative indexOfAny introduces local variables to traverse collections (both the string and the character set). By using higher-order functions such as map and sequence comprehensions such as for, the functional index-of-any avoids all need for variables. Unnecessary complexity tends to snowball. For example, the special case branches in the imperative indexOfAny use the magic number -1 to indicate a nonmatch. Should the magic number be a symbolic constant?
Hands-On Functional Programming in RUST by Andrew Johnson
anti-pattern, Debian, domain-specific language, don't repeat yourself, Donald Knuth, functional programming, higher-order functions, level 1 cache, premature optimization
A single function can define the operation for all numerical types. Explicit bounds must be set for even basic operations, such as multiply or even copy, in intro_generics.rs: fn foo<T>(x: T) -> T where T: std::ops::Mul<Output=T> + Copy { x*x } Even functions can be sent as parameters. We call these higher-order functions. Here is a trivial function that accepts a function and argument, then calls the function with the argument, returning the result. Note the trait bound Fn, indicating that the provided function is a closure. For an object to be callable, it must implement one of the fn, Fn, FnMut, or FnOnce traits in intro_generics.rs: fn bar<F,T>(f: F, x: T) -> T where F: Fn(T) -> T { f(x) } Functions as values Functions are nominally the big feature of functional programming.
…
In this fashion, functions can be chained together to create complex effects from simple steps. This is shown with the following code snippet, in intro_patterns.rs: let fsin = |x: f64| x.sin(); let fabs = |x: f64| x.abs(); //feed output of one into the other let transform = |x: f64| fabs(fsin(x)); Higher-order functions: These have already been mentioned before, but we haven't used the term yet. A HoF is a function that accepts a function as a parameter. Many iterator methods are HoFs. Consider the following example, in intro_patterns.rs: fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool { ... } Functors: If you can get past the name, these are a simple and effective design pattern.
…
A tuple is a container of a fixed number of miscellaneous values. What control flow expression was designed for use with Enums? Pattern matching expressions are a match for Enums, and vice-versa. What is the name for a function with a function as a parameter? Functions of functions are called higher-order functions. How many times will fib be called in memoized fib(20)? fib will be called 39 times. fib will be invoked 21 times. What datatypes can be sent over a channel? Sent data must implement Send, which is usually derived by the compiler automatically. Why do functions need to be boxed when returned from a function?
Types and Programming Languages by Benjamin C. Pierce
Albert Einstein, combinatorial explosion, experimental subject, finite state, functional programming, Henri Poincaré, higher-order functions, Perl 6, power law, Russell's paradox, sorting algorithm, Turing complete, Turing machine, type inference, Y Combinator
* * * * * * Required Background The text assumes no preparation in the theory of programming languages, but readers should start with a degree of mathematical maturity—in particular, rigorous undergraduate coursework in discrete mathematics, algorithms, and elementary logic. Readers should be familiar with at least one higher-order functional programming language (Scheme, ML, Haskell, etc.), and with basic concepts of programming languages and compilers (abstract syntax, BNF grammars, evaluation, abstract machines, etc.). This material is available in many excellent undergraduate texts; I particularly like Essentials of Programming Languages by Friedman, Wand, and Haynes (2001) and Programming Language Pragmatics by Scott (1999).
…
* * * * * * 1.4 Capsule History In computer science, the earliest type systems were used to make very simple distinctions between integer and floating point representations of numbers (e.g., in Fortran). In the late 1950s and early 1960s, this classification was extended to structured data (arrays of records, etc.) and higher-order functions. In the 1970s, a number of even richer concepts (parametric polymorphism, abstract data types, module systems, and subtyping) were introduced, and type systems emerged as a field in its own right. At the same time, computer scientists began to be aware of the connections between the type systems found in programming languages and those studied in mathematical logic, leading to a rich interplay that continues to the present.
…
These examples are not intended to suggest that the lambda-calculus should be taken as a full-blown programming language in its own right-all widely used high-level languages provide clearer and more efficient ways of accomplishing the same tasks-but rather are intended as warm-up exercises to get the feel of the system. Multiple Arguments To begin, observe that the lambda-calculus provides no built-in support for multi-argument functions. Of course, this would not be hard to add, but it is even easier to achieve the same effect using higher-order functions that yield functions as results. Suppose that s is a term involving two free variables x and y and that we want to write a function f that, for each pair (v,w) of arguments, yields the result of substituting v for x and w for y in s. Instead of writing f = λ(x,y).s, as we might in a richer programming language, we write f = λx.λy.s.
ClojureScript: Up and Running by Stuart Sierra, Luke Vanderhart
domain-specific language, Firefox, functional programming, higher-order functions, machine readable, MVC pattern, Paul Graham, web application
This is only to prevent the value of the i symbol from being printed back at the REPL, which ClojureScript does by default. i can exist as a lazy sequence using hardly any memory, but if you try to print it, it will try to print the entire thing to the REPL. Obviously, this is impossible. This is one thing to be careful of when using infinite lazy sequences: don’t do something that would cause them to be printed! This will almost certainly crash your process and force you to restart. iterate is a higher-order function that takes two arguments, a function and an initial value. It returns a lazy sequence with a first element of the initial value. Its rest sequence is lazily constructed, and in turn has an first value of the function applied to the initial value. Its rest, also lazy, is the result of applying the function to the previous value, and so on.
…
Although you don’t have to know them all, familiarity with the basic ones covered here is critical to writing idiomatic functional code. In particular, you should become very comfortable with map, reduce, and filter if you’re not already; these are the staples of the functional programming style. map map is a higher order function that takes a function (which takes a single argument) and a sequence, and returns a sequence of items resulting from applying the function to each item in the input sequence. It is lazy; the input sequence is only consumed and the mapping function applied when the resulting sequence is realized.
Data Science from Scratch: First Principles with Python by Joel Grus
backpropagation, confounding variable, correlation does not imply causation, data science, deep learning, Hacker News, higher-order functions, natural language processing, Netflix Prize, p-value, Paul Graham, recommendation engine, SpamAssassin, statistical model
It ends up the same as if you’d called: zip(('a', 1), ('b', 2), ('c', 3)) which returns [('a','b','c'), ('1','2','3')]. You can use argument unpacking with any function: def add(a, b): return a + b add(1, 2) # returns 3 add([1, 2]) # TypeError! add(*[1, 2]) # returns 3 It is rare that we’ll find this useful, but when we do it’s a neat trick. args and kwargs Let’s say we want to create a higher-order function that takes as input some function f and returns a new function that for any input returns twice the value of f: def doubler(f): def g(x): return 2 * f(x) return g This works in some cases: def f1(x): return x + 1 g = doubler(f1) print g(3) # 8 (== ( 3 + 1) * 2) print g(-1) # 0 (== (-1 + 1) * 2) However, it breaks down with functions that take more than a single argument: def f2(x, y): return x + y g = doubler(f2) print g(1, 2) # TypeError: g() takes exactly 1 argument (2 given) What we need is a way to specify a function that takes arbitrary arguments.
…
It works the other way too, if you want to use a list (or tuple) and dict to supply arguments to a function: def other_way_magic(x, y, z): return x + y + z x_y_list = [1, 2] z_dict = { "z" : 3 } print other_way_magic(*x_y_list, **z_dict) # 6 You could do all sorts of strange tricks with this; we will only use it to produce higher-order functions whose inputs can accept arbitrary arguments: def doubler_correct(f): """works no matter what kind of inputs f expects""" def g(*args, **kwargs): """whatever arguments g is supplied, pass them through to f""" return 2 * f(*args, **kwargs) return g g = doubler_correct(f2) print g(1, 2) # 6 Welcome to DataSciencester!
…
The easiest way to do this is by adding one vector at a time: def vector_sum(vectors): """sums all corresponding elements""" result = vectors[0] # start with the first vector for vector in vectors[1:]: # then loop over the others result = vector_add(result, vector) # and add them to the result return result If you think about it, we are just reduce-ing the list of vectors using vector_add, which means we can rewrite this more briefly using higher-order functions: def vector_sum(vectors): return reduce(vector_add, vectors) or even: vector_sum = partial(reduce, vector_add) although this last one is probably more clever than helpful. We’ll also need to be able to multiply a vector by a scalar, which we do simply by multiplying each element of the vector by that number: def scalar_multiply(c, v): """c is a number, v is a vector""" return [c * v_i for v_i in v] This allows us to compute the componentwise means of a list of (same-sized) vectors: def vector_mean(vectors): """compute the vector whose ith element is the mean of the ith elements of the input vectors""" n = len(vectors) return scalar_multiply(1/n, vector_sum(vectors)) A less obvious tool is the dot product.
Purely Functional Data Structures by Chris Okasaki
Donald Knuth, Ford Model T, functional programming, higher-order functions, reversible computing, Turing machine, type inference
This is a specific instance of a very common program schema, which can be written for any c and left-associative 0 . Other instances of this schema include summing a list of integers (c = 0 and 0 = +) or finding the maximum of a list of natural numbers (c = 0 and 0 = max). One of the greatest strengths of functional languages is the ability to define schemas like this as higher-order functions (i.e., functions that take functions as arguments or return functions as results). For example, the above schema might be written f u n foldl (f, c, []) = c | foldl (f, c, x :: xs) = foldl (f, f (c, x), xs) Then sort could be written fun sort (size, segs) = foldl (mrg, [], force segs) O The complete code for this implementation of sortable collections appears in Figure 6.5.
…
Then update is simply fun update (/, y, xs) = fupdate (fn x ^ y, /, xs) The key step in fupdate is promoting a function f on elements to a function f that takes a pair and applies f to either the first or second element of the pair, depending on the parity of /'. fun f (x, y) = if / mod 2 = 0 then (f x, y) else (x, f y) Given this definition, the rest of fupdate is straightforward. fun fupdate (f, 0, O N E (X, ps)) = O N E (f x, ps) | fupdate (f, i, O N E (X, ps)) = cons (x, fupdate {f, / - 1 , ZERO ps)) | fupdate (f, /, ZERO ps) = let fun f (x, y) = if / mod 2 = 0 then (f x, y) else (x, f y) in ZERO (fupdate (f, i div 2, ps)) end The complete implementation is shown in Figure 10.1. Comparing Figures 10.1 and 9.6, we see that this implementation is significantly more concise and that the individual functions are significantly simpler, with the possible exception of update. (And even update is simpler if you are comfortable with higher-order functions.) These benefits arise from recasting the data structure as a non-uniform type that directly reflects the desired invariants. Exercise 10.2 Reimplement AltBinaryRandomAccessList so that cons, head, and tail all run in 0(1) amortized time, using the type datatype a RList = NIL | O N E of a x (a x a) RList susp | Two of a x a x (a x a) RList susp j THREE of a x a x a x (a x a) RList susp 10.1.3 Bootstrapped Queues Consider the use of -H- in the banker's queues of Section 6.3.2.
…
(p. 37) Index $-notation, 31-34 abstract data type, 3 abstraction, 3 accumulated debt, 58,60 accumulated savings, 40, 58 accumulating parameter, 86,95 actual cost, 60 AltBinaryRandomAccessList (structure), 147 amortization banker's method, see banker's method eliminating, see scheduling physicist's method, see physicist's method problem with persistence, 54-55 traditional, 39^1 anticredits, 81 assignments, 2 banker's method justification of, 62-63 traditional, 40 with lazy evaluation, 61-62,69 BankersDeque (functor), 110 BankersQueue (structure), 65 batched rebuilding, 99-101 BatchedQueue (structure), 43 binary search trees, 99 delete, 100 red-black, 24-28,203 unbalanced, 11-14, 203 BinaryRandomAccessLJst (structure), 123 binomial heaps, 20-24,45^6,70, 89-93,198 binomial queues, see binomial heaps binomial trees, 21, 118, see also fc-nomial trees BinomialHeap (functor), 24 Bootstrap (functor), 161 bootstrap loader, 141 BootstrappedQueue (structure), 149 bootstrapping, 141, see also data-structural bootstrapping bootstrapping a compiler, 141 bottom-up mergesort, 74-78,94-97,202 BottomUpMergeSort (structure), 77 c-deques, see catenable deques caching, 3 call-by-name, 59,63 call-by-need, see lazy evaluation call-by-value, see strict evaluation catenable deques, 175-184,191,192 implicit, 177-184 signature, 176,191 simple, 175-178 catenable lists, 153-158,169,191 signature, 153,190 CATENABLEDEQUE (signature), 176 CatenableList (functor), 156 CATENABLELlST (signature), 153 cheap operations, 40 chef's knives, 2 complete binary leaf trees, 118 complete binary trees, 118,132 complete cost, 60 completefc-aryleaf trees, 138 completefc-arytrees, 138 copying, 7 coroutines, 101, 102,106,113 217 218 Index credits, 40, 41 dancing bear, 2 data structure, meanings of, 3—4 data-structural bootstrapping, 169 debit inheritance, 67-68 debit passing, 174, 183 dense representations, 116,117 DEQUE (signature), 45, 107 deques, 44, 106,113 banker's, 108-110,189 output-restricted, 107 real-time, 111-112,170 signature, 45, 107, 189 destructive updates, 2 digital search trees, see tries dominoes, 85 double-ended queues, see deques ephemeral data structures, 2,4, 58 execution traces, 57,62-63 expensive operations, 40, 59, 62 ExplJcltMJn (functor), 23 FIFO queues, see queues finite maps over products, 167 over sums, 168 signature, 163, 204 FlNITEMAP (signature), 16,163 flexible arrays, see random-access lists foldM, 155 Ford, Henry, 1 function (as opposed to operation), 4 functional programming, theoretical efficiency of, 2 functors in Standard ML, 4 future, logical, 57 garbage collection, 10 global rebuilding, 98, 101-102,106, 113 hash table, 165, 166 HEAP (signature), 18 heap-ordered trees, 17 heaps, 169 binomial, 20-24,45-46,198 binomial, lazy, 70-71,162 binomial, scheduled, 89-93 bootstrapped, 158-162,201 delete, 138 leftist, 17-20,52, 197 leftist, weight-biased, 19 pairing, 52-54,56, 199 pairing, lazy, 79-81, 200 signature, 18, 162,197 skew binomial, 134-137,162, 170, 200 splay, 46-52, 56, 198 H E A P WITH INFO (signature), 162 higher-order functions, 76 higher-order functors, 160 hints to practitioners, 26, 44, 52, 53, 81, 89, 133,150, 158 history, logical, 57, 61 HoodMelvilleQueue (structure), 105 imperative data structures, 2 implementation, 3 implicit recursive slowdown, 171 ImplicitCatenableDeque (functor), 181, 182 ImplJcitQueue (structure), 174 incremental computations, 34, 61, 62, 67, 70 interactive systems, 83 intrinsic cost, 84 /c-nomial trees, 138 knives, 2 layaway plan, 60 lazy evaluation, 2, 31, 37, 59 syntax for, see $-notation time analysis, 60, 82 lazy numerical representations, 125-127 lazy rebuilding, 104-106 LazyBinomialHeap (functor), 71 LazyPairingHeap (functor), 80 leaf tree, 118 left-associative appends, 147 leftist heaps, 17-20, 52, 197 LeftistHeap (functor), 20 life cycle of suspensions, 61 lists, 7-10 logical future, 57,59,61,85 logical history, 57, 61 memoization, 3, 37, 63 mergeable heaps, see heaps mergesort, see bottom-up mergesort Model T, 1 monolithic computations, 34, 61, 62, 67, 70 Index nested suspensions, 60, 67, 106 non-uniform recursion, 142-144, see also polymorphic recursion normal-order reduction, 37 numerical representations, 115 object, 3 operation, meanings of, 4 operator, 4 or-patterns, 26 O R D E R E D (signature), 14 pairing heaps, 52-54, 56, 79-81,199, 200 PairingHeap (functor), 54 parallel systems, 83 particle-antiparticle annihilation, 81 path compression, 81 path copying, 15 pattern matching, 36 on abstract types, 180 pebble games, 97 pennants, 118,138 persistence problem with amortization, 54-55 persistent data structures, 2, 7, 59, 83 persistent identity, 3 physicist's method limitations, 69 traditional, 40-41,82 with lazy evaluation, 68-70 PhysicistsQueue (structure), 73 polymorphic recursion, 144, 170 positional number systems, 116 potential, 41 priority queues, see heaps quaternary numbers, 138 QUEUE (signature), 42 queues, 97 banker's, 64-67, 86, 106,107, 186 batched, 42-44, 101,186 bootstrapped, 146-150,188 Hood-Melville, 102-105,107, 187 implicit, 172-175,189 physicist's, 72-73,104, 187 real-time, 86-89,106, 107 signature, 42, 186 random-access lists, 119 binary, 119-123,144-147,194, 196 signature, 120, 194 219 skew binary, 132-134,195 RANDOMACCESSLlST (signature), 120 real-time systems, 83 realized costs, 60 realized debits, 63 RealTimeDeque (functor), 112 RealTimeQueue (structure), 88 recursive modules, 160, 161 recursive slowdown, 130, 170,171, 184, see also implicit recursive slowdown red-black trees, 24-28,125, 203 delete, 100 RedBlackSet (functor), 28 redundant number system, 116 reference cell, 4 ScheduledBinomialHeap (functor), 93 ScheduledBottomUpMergeSort (functor), 96 scheduling, 84-86,106 segmented representations, 127-130 self-modification, 59 SET (signature), 12 sets signature, 202 shared cost, 60 sharing, 7 signatures in Standard ML, 4 SimpleCatenableDeque (functor), 178 skew binary numbers, 131-132 canonical form, 131 skew binomial trees, 135 skewfc-arynumbers, 139 SkewBinaryRandomAccessLJst (structure), 134 SkewBinomialHeap (functor), 137 snoc, etymology of, 42 SORTABLE (signature), 74 sortable collections, 74 signature, 74, 202 sparse representations, 116, 117 splay trees, 46-52, 56, 59, 198 SplayHeap (functor), 50 STACK (signature), 8 steques, see output-restricted deques Stream (structure), 36 STREAM (signature), 36 streams, 34-37 signature, 36 strict evaluation, 2, 59 structural abstraction, 151-153,170 220 Index structural decomposition, 142 structures in Standard ML, 4 suspensions, 31 as nullary functions, 37 life cycle of, 61 nested, 60, 67,106 trivial, 35 telescoping series, 41 terminology, 3-4 Trie (functor), 165 TrieOfTrees (functor), 168 tries, 163-168,204 trinary numbers, 138 trivial suspensions, 35 UnbalancedSet (functor), 14 uniform recursion, 142 unrealized costs, 60 unshared cost, 60 values in Standard ML, 4 version, 3 version graphs, 58 views, 180 weak updates, 100 worst-case data structures, benefits of, 83 zeroless representations, 122-125
Real World Haskell by Bryan O'Sullivan, John Goerzen, Donald Stewart, Donald Bruce Stewart
bash_history, database schema, Debian, distributed revision control, domain-specific language, duck typing, en.wikipedia.org, Firefox, functional programming, general-purpose programming language, Guido van Rossum, higher-order functions, job automation, Larry Wall, lateral thinking, level 1 cache, machine readable, p-value, panic early, plutocrats, revision control, sorting algorithm, SQL injection, transfer pricing, type inference, web application, Yochai Benkler
We can learn a lot about what map does by simply inspecting its type: ghci> :type map map :: (a -> b) -> [a] -> [b] The signature tells us that map takes two arguments. The first is a function that takes a value of one type, a, and returns a value of another type, b. Because map takes a function as an argument, we refer to it as a higher-order function. (In spite of the name, there’s nothing mysterious about higher-order functions; it’s just a term for functions that take other functions as arguments, or return functions.) Since map abstracts out the pattern common to our square and upperCase functions so that we can reuse it with less boilerplate, we can look at what those functions have in common and figure out how to implement it ourselves: -- file: ch04/Map.hs myMap :: (a -> b) -> [a] -> [b] myMap f (x:xs) = f x : myMap f xs myMap _ _ = [] What are those wild cards doing there?
…
We try out our myMap function to give ourselves some assurance that it behaves similarly to the standard map: ghci> :module +Data.Char ghci> map toLower "SHOUTING" "shouting" ghci> myMap toUpper "whispering" "WHISPERING" ghci> map negate [1,2,3] [-1,-2,-3] This pattern of spotting a repeated idiom, and then abstracting it so we can reuse (and write less!) code, is a common aspect of Haskell programming. While abstraction isn’t unique to Haskell, higher-order functions make it remarkably easy. Selecting Pieces of Input Another common operation on a sequence of data is to comb through it for elements that satisfy some criterion. Here’s a function that walks a list of numbers and returns those that are odd. Our code has a recursive case that’s a bit more complex than our earlier functions—it puts a number in the list it returns only if the number is odd.
…
.&. 0xff)) `mod` base b' = (a' + b) `mod` base in helper (a',b') xs helper (a,b) _ = (b `shiftL` 16) .|. a Why would we want to make this seemingly meaningless structural change? Because as we’ve already seen with map and filter, we can extract the common behavior shared by mySum and adler32_try2 into a higher-order function. We can describe this behavior as “do something to every element of a list, updating an accumulator as we go, and returning the accumulator when we’re done.” This kind of function is called a fold, because it “folds up” a list. There are two kinds of fold-over lists: foldl for folding from the left (the start), and foldr for folding from the right (the end).
Software Design for Flexibility by Chris Hanson, Gerald Sussman
Alan Turing: On Computable Numbers, with an Application to the Entscheidungsproblem, connected car, domain-specific language, Donald Knuth, en.wikipedia.org, functional programming, Guido van Rossum, higher-order functions, interchangeable parts, loose coupling, Magellanic Cloud, phenotype, premature optimization, Richard Stallman, stem cell, the scientific method, Turing machine, type inference
dx-diff-terms) 0) ((and (null? (cdr dx-diff-terms)) (null? (diff-factors (car dx-diff-terms)))) (diff-coefficient (car dx-diff-terms))) (else (make-differential dx-diff-terms))))) (define-generic-procedure-handler extract-dx-part (match-args differential? diff-factor?) extract-dx-differential) Higher-order functions For many applications we want our automatic differentiator to work correctly for functions that return functions as values: (((derivative (lambda (x) (lambda (y z) (* x y z)))) 2) 3 4) ;Value: 12 Including literal functions and partial derivatives makes this even more interesting.
…
We also can get into complications with the typing of symbolic functions. One beautiful example of the power of extensible generics is the almost trivial implementation of forward-mode automatic differentiation by extending each primitive arithmetic procedure to handle differential objects. However, making this work correctly with higher-order functions that return functions as values was difficult. (Of course, most programmers writing applications that need automatic differentiation do not need to worry about this complication.) In our system the “type” is represented by a predicate that is true of elements of that type. In order to make this efficient we introduced a predicate registration and tagging system that allowed us to add declarations of relationships among the types.
…
[86]Harvey Lodish, Arnold Berk, S Lawrence Zipursky, Paul Matsudaira, David Baltimore, and James E Darnell; Molecular Cell Biology (4th ed.). New York: W. H. Freeman & Co., 1999. [87]Oleksandr Manzyuk, Barak A. Pearlmutter, Alexey Andreyevich Radul, David R. Rush, and Jeffrey Mark Siskind; “Confusion of Tagged Perturbations in Forward Automatic Differentiation of Higher-Order Functions,” arxiv:1211.4892 (2012). [88]David Allen McAllester; A three-valued truth-maintenance system, AI Memo 473, MIT Artificial Intelligence Laboratory, 1978. [89]David Allen McAllester “An outlook on truth maintenance,” AI Memo 551, MIT Artificial Intelligence Laboratory, 1980. [90]John McCarthy; “A basis for a mathematical theory of computation,” in Computer Programming and Formal Systems, ed.
Natural language processing with Python by Steven Bird, Ewan Klein, Edward Loper
bioinformatics, business intelligence, business logic, Computing Machinery and Intelligence, conceptual framework, Donald Knuth, duck typing, elephant in my pajamas, en.wikipedia.org, finite state, Firefox, functional programming, Guido van Rossum, higher-order functions, information retrieval, language acquisition, lolcat, machine translation, Menlo Park, natural language processing, P = NP, search inside the book, sparse data, speech recognition, statistical model, text mining, Turing test, W. E. B. Du Bois
. >>> list(permutations(['police', 'fish', 'buffalo'])) [['police', 'fish', 'buffalo'], ['fish', 'police', 'buffalo'], ['fish', 'buffalo', 'police'], ['police', 'buffalo', 'fish'], ['buffalo', 'police', 'fish'], ['buffalo', 'fish', 'police']] The permutations function uses a technique called recursion, discussed later in Section 4.7. The ability to generate permutations of a set of words is useful for creating data to test a grammar (Chapter 8). Higher-Order Functions Python provides some higher-order functions that are standard features of functional programming languages such as Haskell. We illustrate them here, alongside the equivalent expression using list comprehensions. Let’s start by defining a function is_content_word() which checks whether a word is from the open class of content words.
…
.'] >>> sent = ['Take', 'care', 'of', 'the', 'sense', ',', 'and', 'the', ... 'sounds', 'will', 'take', 'care', 'of', 'themselves', '.'] >>> filter(is_content_word, sent) ['Take', 'care', 'sense', 'sounds', 'take', 'care', 'themselves'] >>> [w for w in sent if is_content_word(w)] ['Take', 'care', 'sense', 'sounds', 'take', 'care', 'themselves'] Another higher-order function is map(), which applies a function to every item in a sequence. It is a general version of the extract_property() function we saw earlier in this section. Here is a simple way to find the average length of a sentence in the news section of the Brown Corpus, followed by an equivalent version with list comprehension calculation: >>> lengths = map(len, nltk.corpus.brown.sents(categories='news')) >>> sum(lengths) / len(lengths) 21.7508111616 >>> lengths = [len(w) for w in nltk.corpus.brown.sents(categories='news'))] >>> sum(lengths) / len(lengths) 21.7508111616 In the previous examples, we specified a user-defined function is_content_word() and a built-in function len().
…
. >>> [2, >>> [2, map(lambda w: len(filter(lambda c: c.lower() in "aeiou", w)), sent) 2, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 1, 3, 0] [len([c for c in w if c.lower() in "aeiou"]) for w in sent] 2, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 1, 3, 0] The solutions based on list comprehensions are usually more readable than the solutions based on higher-order functions, and we have favored the former approach throughout this book. Named Arguments When there are a lot of parameters it is easy to get confused about the correct order. Instead we can refer to parameters by name, and even assign them a default value just in case one was not provided by the calling program.
Python Tricks: The Book by Dan Bader
anti-pattern, business logic, data science, domain-specific language, don't repeat yourself, functional programming, Hacker News, higher-order functions, linked data, off-by-one error, pattern recognition, performance metric
It allows you to abstract away and pass around behavior in your programs. In this example, the greet function stays the same but you can influence its output by passing in different greeting behaviors. Functions that can accept other functions as arguments are also called higher-order functions. They are a necessity for the functional programming style. The classical example for higher-order functions in Python is the built-in map function. It takes a function object and an iterable, and then calls the function on each element in the iterable, yielding the results as it goes along. Here’s how you might format a sequence of greetings all at once by mapping the bark function to them: >>> list(map(bark, ['hello', 'hey', 'hi'])) ['HELLO!'
Exploring Python by Timothy Budd
c2.com, centre right, duck typing, functional programming, general-purpose programming language, Guido van Rossum, higher-order functions, index card, random walk, sorting algorithm, web application
Each of these three basic tasks is provided by a function in the Python library. Notice that the definition of each of these functions talk about invoking another function as part of the process. The function used in this case is passed as an argument. A function that uses another function that is passed as an argument is sometimes referred to as a higher-order function. Lambda Functions When a function is required as an argument, one possibility is to simply pass the name of a previously-defined function: def even(x): return x % 2 == 0 >>> a = [1, 2, 3, 4, 5] >>> print filter(even, a) [2, 4] However, because the functions that are passed as argument to maps, reductions and filters are often simple, and are usually used nowhere else, it is inconvenient to require the programmer to define them using the standard def keyword.
…
Once you have described the quick sort algorithm in this fashion, the solution is a simple transliteration: def quicksort(a): if a: # there are various ways of selecting the pivot # we simply choose the middle element pivot = a[len(a)/2] return (quickSort([x for x in a if x < pivot]) + [x for x in a if x == pivot] + quickSort([x for x in a if x > pivot])) else: return [ ] We have illustrated higher order functions by passing lambda expressions to functions such as filter and map. The flip side is to write a function that accepts a function as argument. For example, you might want a sorting function that allows the user to provide the comparison test as an argument, rather than using the < operator.
Beautiful Architecture: Leading Thinkers Reveal the Hidden Beauty in Software Design by Diomidis Spinellis, Georgios Gousios
Albert Einstein, barriers to entry, business intelligence, business logic, business process, call centre, continuous integration, corporate governance, database schema, Debian, domain-specific language, don't repeat yourself, Donald Knuth, duck typing, en.wikipedia.org, fail fast, fault tolerance, financial engineering, Firefox, Free Software Foundation, functional programming, general-purpose programming language, higher-order functions, iterative process, linked data, locality of reference, loose coupling, meta-analysis, MVC pattern, Neal Stephenson, no silver bullet, peer-to-peer, premature optimization, recommendation engine, Richard Stallman, Ruby on Rails, semantic web, smart cities, social graph, social web, SPARQL, Steve Jobs, Stewart Brand, Strategic Defense Initiative, systems thinking, the Cathedral and the Bazaar, traveling salesman, Turing complete, type inference, web application, zero-coupon bond
Lisp first showed that this could be done effectively; a number of mainstream languages offered a way to pass routines as arguments to other routines, but this was not considered a fundamental design technique, and was in fact sometimes viewed with suspicion as reminiscent of self-modifying code with all the associated uncertainties. Modern functional languages showed the benefit of accepting higher-order functionals as regular program objects, and developed the associated type systems. This is the part of functional programming that has had the most direct effect on the development of mainstream approaches to programming; as will be seen below, the notion of agent, directly derived from these functional programming concepts, is a welcome addition to the original object-oriented framework.
…
Recognizing the impossibility of ignoring the state for such operations as input and output, and the clumsiness of earlier attempts (Peyton Jones and Wadler 1993), modern functional languages, in particular Haskell, have introduced the notion of monad (Wadler 1995). Monads embed the original functions in higher-order functions with more complex signatures; the added signature components can serve to record state information, as well as any extra elements such as an error status (to model exception handling) or input-output results. Using monads to integrate the state proceeds from the same general idea—used in the reverse direction—as the technique described in the last section for obtaining lazy behavior by modeling infinite sequences as an abstract data type: to emulate in a framework A a technique T that is implicit in a framework B, program in A an explicit version of T or of the key mechanism making T possible.
…
Inner classes do manage to do the job, but one can readily see, as in the elimination of the Visitor pattern with its proliferation of puny classes, the improvement in simplicity, elegance, and modularity brought by an agent-based solution. Agents, it was noted above, allow object-oriented design to provide the same expressive power of functional programming through a general mechanism for defining higher-order functionals (operations that can use operations—themselves recursively enjoying the same property—as their inputs and outputs). Even lambda expressions find their counterpart in inline agents. These mechanisms were openly influenced by functional programming and should in principle attract the enthusiasm of its proponents, although one fears that some will view this debt acknowledgment as an homage that vice pays to virtue (La Rochefoucauld 1665).
Advances in Artificial General Intelligence: Concepts, Architectures and Algorithms: Proceedings of the Agi Workshop 2006 by Ben Goertzel, Pei Wang
AI winter, artificial general intelligence, backpropagation, bioinformatics, brain emulation, classic study, combinatorial explosion, complexity theory, computer vision, Computing Machinery and Intelligence, conceptual framework, correlation coefficient, epigenetics, friendly AI, functional programming, G4S, higher-order functions, information retrieval, Isaac Newton, Jeff Hawkins, John Conway, Loebner Prize, Menlo Park, natural language processing, Nick Bostrom, Occam's razor, p-value, pattern recognition, performance metric, precautionary principle, Ray Kurzweil, Rodney Brooks, semantic web, statistical model, strong AI, theory of mind, traveling salesman, Turing machine, Turing test, Von Neumann architecture, Y2K
Looks / Program Evolution for General Intelligence number of scoring function evaluations needed to find an optimal solution have already been achieved relative to genetic programming [10], on a number of benchmarks, in addition to the ant results presented herein. Future work will focus on advanced problem domains (higher-order functions, list manipulation, recursion, etc.), more adaptive representation-building for better scalability, exploiting additional inductive bias in the behavioral space, and, most importantly in the long-term, integration with other AI components. Acknowledgements Thanks to Ben Goertzel for many suggestions and discussions which have been instrumental in developing the ideas presented in this paper.
…
. / Indefinite Probabilities for General Intelligence 196 knowledge). Among the general high-level requirements underlying the development of PLN have been the following: • • • • • • • To enable uncertainty-savvy versions of all known varieties of logical reasoning, including for instance higher-order reasoning involving quantifiers, higher-order functions, and so forth. To reduce to crisp “theorem prover” style behavior in the limiting case where uncertainty tends to zero. To encompass inductive and abductive as well as deductive reasoning. To agree with probability theory in those reasoning cases where probability theory, in its current state of development, provides solutions within reasonable calculational effort based on assumptions that are plausible in the context of real-world data.
Racing the Beam: The Atari Video Computer System by Nick Montfort, Ian Bogost
Colossal Cave Adventure, Fairchild Semiconductor, functional programming, game design, Google Earth, higher-order functions, Ian Bogost, Ivan Sutherland, Marshall McLuhan, Menlo Park, Rubik’s Cube, Silicon Valley, SimCity, software studies, Steve Wozniak
They would often run out of ROM space. Most 6502 assembly instructions are two bytes: one for the opcode and one for the operand. Saving space on ROM requires consolidating code—usually removing one line for every two bytes of space reclaimed. Assembler programs are composed of elementary instructions, not of higher-order functions. For example, the following assembly language instructions load a value from the top of RAM, add the value 8 to it, and store the result in the TIA register that sets the background color: LDA $80 ADC #$08 STA COLUBK [102] Each of the opcodes (LDA, ADC, and STA, in this case) are mnemonic shortcuts for one-byte hexadecimal values that tell the processor what operation to execute.
Know Thyself by Stephen M Fleming
Abraham Wald, Alan Turing: On Computable Numbers, with an Application to the Entscheidungsproblem, AlphaGo, autism spectrum disorder, autonomous vehicles, availability heuristic, backpropagation, citation needed, computer vision, confounding variable, data science, deep learning, DeepMind, Demis Hassabis, Douglas Hofstadter, Dunning–Kruger effect, Elon Musk, Estimating the Reproducibility of Psychological Science, fake news, global pandemic, higher-order functions, index card, Jeff Bezos, l'esprit de l'escalier, Lao Tzu, lifelogging, longitudinal study, meta-analysis, mutually assured destruction, Network effects, patient HM, Pierre-Simon Laplace, power law, prediction markets, QWERTY keyboard, recommendation engine, replication crisis, self-driving car, side project, Skype, Stanislav Petrov, statistical model, theory of mind, Thomas Bayes, traumatic brain injury
And, as our species is the proud owner of the biggest primate brain by mass, this creates an advantage when it comes to sheer number of neurons. The upshot is that what makes our brains special is that (a) we are primates, and (b) we have big heads!15 We do not yet know what this means. But, very roughly, it is likely that there is simply more processing power devoted to so-called higher-order functions—those that, like self-awareness, go above and beyond the maintenance of critical functions like homeostasis, perception, and action. We now know that there are large swaths of cortex in the human brain that are not easy to define as being sensory or motor, and are instead traditionally labeled as association cortex—a somewhat vague term that refers to the idea that these regions help associate or link up many different inputs and outputs.
The Pragmatic Programmer by Andrew Hunt, Dave Thomas
A Pattern Language, Broken windows theory, business logic, business process, buy low sell high, c2.com, combinatorial explosion, continuous integration, database schema, domain-specific language, don't repeat yourself, Donald Knuth, Ford Model T, Free Software Foundation, general-purpose programming language, George Santayana, Grace Hopper, higher-order functions, if you see hoof prints, think horses—not zebras, index card, Kaizen: continuous improvement, lateral thinking, loose coupling, Menlo Park, MVC pattern, off-by-one error, premature optimization, Ralph Waldo Emerson, revision control, Schrödinger's Cat, slashdot, sorting algorithm, speech recognition, systems thinking, the Cathedral and the Bazaar, traveling salesman, urban decay, Y2K
[URL 11] ISE Eiffel ⇒ www.eiffel.com Interactive Software Engineering is the originator of Design by Contract, and sells a commercial Eiffel compiler and related tools. [URL 12] Sather ⇒ www.icsi.berkeley.edu/~sather Sather is an experimental language that grew out of Eiffel. It aims to support higher-order functions and iteration abstraction as well as Common Lisp, CLU, or Scheme, and to be as efficient as C, C++, or Fortran. [URL 13] VisualWorks ⇒ www.cincom.com Home of the VisualWorks Smalltalk environment. Noncommercial versions for Windows and Linux are available for free. [URL 14] The Squeak Language Environment ⇒ squeak.cs.uiuc.edu Squeak is a freely available, portable implementation of Smalltalk-80 written in itself; it can produce C code output for higher performance.
Speaking JavaScript: An In-Depth Guide for Programmers by Axel Rauschmayer
Airbnb, anti-pattern, digital divide, en.wikipedia.org, fail fast, Firefox, functional programming, higher-order functions, machine readable, web application
On the other hand, it has several powerful features that allow you to work around these problems. In other languages, you learn language features. In JavaScript, you often learn patterns instead. Given its influences, it is no surprise that JavaScript enables a programming style that is a mixture of functional programming (higher-order functions; built-in map, reduce, etc.) and object-oriented programming (objects, inheritance). Syntax This section explains basic syntactic principles of JavaScript. An Overview of the Syntax A few examples of syntax: // Two slashes start single-line comments var x; // declaring a variable x = 3 + y; // assigning a value to the variable `x` foo(x, y); // calling function `foo` with parameters `x` and `y` obj.bar(3); // calling method `bar` of object `obj` // A conditional statement if (x === 0) { // Is `x` equal to zero?
Scala in Depth by Tom Kleenex, Joshua Suereth
discrete time, domain-specific language, duck typing, fault tolerance, functional programming, higher-order functions, MVC pattern, sorting algorithm, type inference
It’s important to remember that all type programming is enforced during compilation and all type information must be known at compile time to be useful. Type parameters also make possible the creation of higher-kinded types. 6.3.2. Higher-kinded types Higher-kinded types are those that use other types to construct a new type. This is similar to how higher-order functions are those that take other functions as parameters. A higher-kinded type can have one or more other types as parameters. In Scala, you can do this using the type keyword. Here’s an example of a higher-kinded type. type Callback[T] = Function1[T, Unit] The type definition declares a higher-kinded type called Callback.
The Moral Landscape: How Science Can Determine Human Values by Sam Harris
Albert Einstein, banking crisis, Bayesian statistics, behavioural economics, cognitive bias, cognitive load, end world poverty, endowment effect, energy security, experimental subject, framing effect, higher-order functions, hindsight bias, impulse control, John Nash: game theory, language acquisition, longitudinal study, loss aversion, meta-analysis, mirror neurons, Monty Hall problem, out of africa, Paradox of Choice, pattern recognition, peak-end rule, placebo effect, Ponzi scheme, public intellectual, Richard Feynman, risk tolerance, scientific worldview, stem cell, Stephen Hawking, Steven Pinker, TED Talk, the scientific method, theory of mind, traumatic brain injury, trolley problem, ultimatum game, World Values Survey
But we are not likely to find a region of the human brain devoted solely to belief. The brain is an evolved organ, and there does not seem to be a process in nature that allows for the creation of new structures dedicated to entirely novel modes of behavior or cognition. Consequently, the brain’s higher-order functions had to emerge from lower-order mechanisms. An ancient structure like the insula, for instance, helps monitor events in our gut, governing the perception of hunger and primary emotions like disgust. But it is also involved in pain perception, empathy, pride, humiliation, trust, music appreciation, and addictive behavior.16 It may also play an important role in both belief formation and moral reasoning.
The Confidence Game: The Psychology of the Con and Why We Fall for It Every Time by Maria Konnikova
Abraham Maslow, attribution theory, Bear Stearns, behavioural economics, Bernie Madoff, Bluma Zeigarnik, British Empire, Cass Sunstein, cognitive dissonance, cognitive load, coherent worldview, Daniel Kahneman / Amos Tversky, dark triade / dark tetrad, endowment effect, epigenetics, Higgs boson, higher-order functions, hindsight bias, lake wobegon effect, lateral thinking, libertarian paternalism, Milgram experiment, placebo effect, Ponzi scheme, post-work, publish or perish, Richard Thaler, risk tolerance, seminal paper, side project, Skype, Steven Pinker, sunk-cost fallacy, the scientific method, tulip mania, Walter Mischel
The more primates groom, in fact, the larger their possible social group. Robin Dunbar, an anthropologist and evolutionary psychologist at Oxford whose work for over four decades has centered on social bonding in primates, has found that grooming time along with the size of the neocortex (the part of our brain dedicated to higher-order functions) is a perfect proxy for how large our social groups can get. That neocortical size, in turn, signals something very specific. The largest nonhuman social group tops out at about eighty connections. In humans, however, close connections have taken a qualitative jump, to almost double that, coming in at an average of 150—Dunbar’s eponymous number.
The C++ Programming Language by Bjarne Stroustrup
combinatorial explosion, conceptual framework, database schema, Dennis Ritchie, distributed generation, Donald Knuth, fault tolerance, functional programming, general-purpose programming language, higher-order functions, index card, iterative process, job-hopping, L Peter Deutsch, locality of reference, Menlo Park, no silver bullet, Parkinson's law, premature optimization, sorting algorithm
These adapters all have a common structure relying on the function object bases uunnaarryy__ffuunnccttiioonn and bbiinnaarryy__ffuunnccttiioonn (§18.4.1). For each of these adapters, a helper function is provided to take a function object as an argument and return a suitable function object. When invoked by its ooppeerraattoorr()(), that function object will perform the desired action. That is, an adapter is a simple form of a higher-order function: it takes a function argument and produces a new function from it: ________________________________________________________________________________ Binders, Adapters, and Negaters <functional> _________________________________________________________________________________ _______________________________________________________________________________ binder2nd Call binary function with y as 2nd argument. bind2nd(y) bbiinnddeerr11sstt Call binary function with x as 1st argument. bbiinndd11sstt((xx)) meem m__ffuunn(()) m meem m__ffuunn__tt Call 0-arg member through pointer.
…
example 46 helper class 293 function 273 function and namespace 240 hex 626– 627, 634 hexadecimal 73 output 626 hiding information 27 name 82 hierarchies, interface 708 hierarchy 732 class 38, 389 class 15, 307, 734 design, class 314 exception 385 navigation, class 411 object 739, 748 reorganization of class 707 stream 637 traditional 315 higher-order function 518 high-level language 7 Histogram 455 horizontal tab \t 830 how to start a design 708 human activity, programming as a 693 hybrid design 718 I ideas, real-world as source of 734 identifier 81 identity() example 531 IEC-559, is_iec559 659 if statement 133 switch and 134 _if suffix 525 #ifdef 162 #ifndef 216 The C++ Programming Language, Third Edition by Bjarne Stroustrup.
2312 by Kim Stanley Robinson
agricultural Revolution, Anthropocene, caloric restriction, caloric restriction, clean tech, double helix, full employment, higher-order functions, hive mind, if you see hoof prints, think horses—not zebras, Jevons paradox, Kim Stanley Robinson, Kuiper Belt, late capitalism, Late Heavy Bombardment, mutually assured destruction, Nelson Mandela, Neolithic agricultural revolution, off-the-grid, offshore financial centre, orbital mechanics / astrodynamics, pattern recognition, phenotype, post scarcity, precariat, quantum entanglement, retrograde motion, rewilding, Skinner box, stem cell, strong AI, synthetic biology, the built environment, the High Line, Tragedy of the Commons, Turing machine, Turing test, Winter of Discontent
Then, next, the usual view is that qubes cannot self-program higher-order mental operations for themselves, because these operations are poorly understood in humans, and there are not even preliminary models to make a start.” “Is that true? Isn’t it generally agreed that the brain does a lot of small operations in different parts of the brain, then other parts correlate these operations into higher-order functions—generalizations, and imagination, and like that? Neural nets and so on?” “Granted, there are preliminary models of that very rough type, but they remain very rough. Blood flow and electrical activity in living brains can be traced quite finely, and in a living brain there is much activity in all parts, shifting around.
Structure and Interpretation of Computer Programs, Second Edition by Harold Abelson, Gerald Jay Sussman, Julie Sussman
Andrew Wiles, conceptual framework, Donald Knuth, Douglas Hofstadter, Eratosthenes, functional programming, Gödel, Escher, Bach, higher-order functions, industrial robot, information retrieval, iterative process, Ivan Sutherland, Johannes Kepler, loose coupling, machine translation, Multics, probability theory / Blaise Pascal / Pierre de Fermat, Richard Stallman, Turing machine, wikimedia commons
After a short time we forget about syntactic details of the language (because there are none) and get on with the real issues—figuring out what we want to compute, how we will decompose problems into manageable parts, and how we will work on the parts. Another advantage of Lisp is that it supports (but does not enforce) more of the large-scale strategies for modular decomposition of programs than any other language we know. We can make procedural and data abstractions, we can use higher-order functions to capture common patterns of usage, we can model local state using assignment and data mutation, we can link parts of a program with streams and delayed evaluation, and we can easily implement embedded languages. All of this is embedded in an interactive environment with excellent support for incremental program design, construction, testing, and debugging.
Structure and interpretation of computer programs by Harold Abelson, Gerald Jay Sussman, Julie Sussman
Andrew Wiles, conceptual framework, Donald Knuth, Douglas Hofstadter, Eratosthenes, Fermat's Last Theorem, functional programming, Gödel, Escher, Bach, higher-order functions, industrial robot, information retrieval, iterative process, Ivan Sutherland, Johannes Kepler, loose coupling, machine translation, Multics, probability theory / Blaise Pascal / Pierre de Fermat, Richard Stallman, Turing machine
After a short time we forget about syntactic details of the language (because there are none) and get on with the real issues – figuring out what we want to compute, how we will decompose problems into manageable parts, and how we will work on the parts. Another advantage of Lisp is that it supports (but does not enforce) more of the large-scale strategies for modular decomposition of programs than any other language we know. We can make procedural and data abstractions, we can use higher-order functions to capture common patterns of usage, we can model local state using assignment and data mutation, we can link parts of a program with streams and delayed evaluation, and we can easily implement embedded languages. All of this is embedded in an interactive environment with excellent support for incremental program design, construction, testing, and debugging.
The Elements of Statistical Learning (Springer Series in Statistics) by Trevor Hastie, Robert Tibshirani, Jerome Friedman
algorithmic bias, backpropagation, Bayesian statistics, bioinformatics, computer age, conceptual framework, correlation coefficient, data science, G4S, Geoffrey Hinton, greed is good, higher-order functions, linear programming, p-value, pattern recognition, random walk, selection bias, sparse data, speech recognition, statistical model, stochastic process, The Wisdom of Crowds
Although the eigenvectors are discrete, we can represent them as functions on IR1 (Exercise 5.17). Figure 5.15 shows the largest 50 eigenvalues of K. The leading eigenfunctions are smooth, and they are successively more wiggly as the order increases. This brings to life the penalty in (5.49), where we see the coefficients of higher-order functions get penalized more than lower-order ones. The right panel in Figure 5.14 shows the correspond2 The ℓth column of Φ is an estimate of φ , evaluated at each of the N observations. ℓ Alternatively, the ith row of Φ is the estimated vector of basis functions φ(xi ), evaluated at the point xi .