舉報

會員
Mastering JavaScript Functional Programming
最新章節:
Answers to Questions
IfyouareaJavaScriptdeveloperandwanttoapplyfunctionalprogrammingtechniques,thenthisbookisforyou.Onlyabasicknowledgeoftheconceptsoffunctionalprogrammingisrequiredforthisbook.
最新章節
- Answers to Questions
- Bibliography
- Summary
- Questions
- Functions as binary trees
- Binary trees in Haskell
品牌:中圖公司
上架時間:2021-07-02 18:47:20
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Answers to Questions 更新時間:2021-07-02 22:41:47
- Bibliography
- Summary
- Questions
- Functions as binary trees
- Binary trees in Haskell
- Functions as data structures
- Unexpected Monads - Promises
- Calling a function - the Try monad
- Handling alternatives - the Either monad
- Adding operations
- Monads
- Dealing with missing values with Maybe
- Enhancing our container: functors
- Wrapping a value: a basic container
- Containers and functors
- Extending current data types
- Containers
- Other type options
- Signatures for functions
- Data types
- Building Better Containers - Functional Data Types
- Summary
- Questions
- Functional design patterns
- Other patterns
- Strategy Template and Command
- Decorator or Wrapper
- Fa?ade and Adapter
- Object-oriented design patterns
- Do we need design patterns?
- Design pattern categories
- What are Design Patterns?
- Implementing Design Patterns - The Functional Way
- Summary
- Questions
- A final caveat
- Updating objects
- Working with lists
- Persistent data structures
- Setting a property by path
- Getting a property
- Getters and setters
- Cloning and mutating
- Freezing
- Constants
- Mutator functions
- The straightforward JS way
- Ensuring Purity - Immutability
- Summary
- Questions
- Recursion elimination
- Trampolines and thunks
- Continuation passing style
- Tail call optimization
- Recursion techniques
- Traversing a tree structure
- The Eight Queens puzzle
- Searching and backtracking
- Other higher-order functions
- Mapping and filtering
- Higher order functions revisited
- Dynamic programming: making change
- Divide and conquer: sorting
- Divide and conquer: The Tower of Hanoi
- Decrease and Conquer: doing powers
- Decrease and Conquer: searching
- Thinking recursively
- Using recursion
- Designing Functions - Recursion
- Summary
- Questions
- Testing composed functions
- Composing with higher order functions
- Finding unique words
- Counting files
- Unary operators
- Some examples of composition
- Composing
- Converting to pointfree style
- Defining pointfree functions
- Pointfree style
- Chaining and fluent interfaces
- Using a logging wrapper
- Tapping into a flow
- Using tee
- Debugging pipelines
- Using other constructs
- Building pipelines by hand
- Creating pipelines
- Revisiting an example
- Piping in Unix/Linux
- Pipelining
- Connecting Functions - Pipelining and Composition
- Summary
- Questions
- Being functional
- Parameter order
- Final thoughts
- Partial currying with closures
- Partial currying with bind()
- Partial currying
- Partial application with closures
- Partial application with eval()
- Partial application with arrow functions
- Partial application
- Currying with eval()
- Currying with bind()
- Currying by hand
- Dealing with many parameters
- Currying
- A bit of theory
- Transforming Functions - Currying and Partial Application
- Summary
- Questions
- Finding the optimum
- Demethodizing - turning methods into functions
- Getting a property from an object
- Turning functions into promises
- A handier implementation
- Implementing operations
- Turning operations into functions
- Other higher-order functions
- Arity changing
- Inverting results
- Logically negating a function
- Doing things once revisited
- Altering functions
- Memoization testing
- More complex memoization
- Simple memoization
- Memoizing
- Timing
- Working in a more pure way
- Taking exceptions into account
- Logging in a functional way
- Logging
- Wrapping functions
- Producing Functions - Higher-Order Functions
- Summary
- Questions
- Checking negatives - none
- Higher level predicates - some every
- Emulating find() and findIndex() with reduce()
- A special search case
- Searching an array
- Emulating filter() with reduce()
- A reduce() example
- Filtering an array
- Logical higher-order functions
- More general looping
- Emulating map() with reduce()
- Working with ranges
- Parsing numbers tacitly
- Extracting data from objects
- Applying an operation - map
- Folding left and right
- Calculating several values at once
- Calculating an average
- Summing an array
- Reducing an array to a value
- Transformations
- Programming Declaratively - A Better Style
- Summary
- Questions
- Testing impure functions
- Testing purified functions
- Testing pure functions
- Testing - pure versus impure
- Is your function pure?
- Injecting impure functions
- Avoiding the usage of state
- Avoiding impure functions
- Impure functions
- Testing
- Self-documentation
- Memoization
- Order of execution
- Advantages of pure functions
- Troublesome functions
- Argument mutation
- Inner state
- Global state
- Usual side effects
- Side effects
- Referential Transparency
- Pure functions
- Behaving Properly - Pure Functions
- Summary
- Questions
- Immediate invocation
- Stubbing
- Adding missing functions
- Detecting Ajax
- Polyfills
- Continuation Passing Style
- Callbacks promises and continuations
- Injection - sorting it out
- Using functions in FP ways
- Working with methods
- An unnecessary mistake
- A React+Redux reducer
- Functions as objects
- One argument or many?
- Working with arguments
- Handling the this value
- Returning values
- Arrow functions - the modern way
- Of lambdas and functions
- All about functions
- Starting Out with Functions - A Core Concept
- Summary
- Questions
- An even better solution
- Testing the solution automatically
- Testing the solution manually
- A higher-order solution
- A functional solution
- Solution #7- use a local flag
- Solution #6 - redefine the handler
- Solution #5 - disable the button
- Solution #4 - change the handle
- Solution #3 - remove the handler
- Solution #2 - use a global flag
- Solution #1 - hope for the best!
- Some bad solutions
- The problem - do something only once
- Thinking Functionally - A First Example
- Summary
- Questions
- Testing
- Working online
- Using transpilers
- How do we work with JavaScript?
- Spread
- Arrow functions
- Closures
- Recursion
- Functions as First Class Objects
- Key features of JavaScript
- Going functional with JavaScript
- JavaScript as a tool
- Is JavaScript functional?
- Not all is gold...
- What we get
- What we need
- Why use Functional Programming?
- What Functional Programming is not
- A different way of thinking
- Theory versus practice
- What is Functional Programming?
- Becoming Functional - Several Questions
- Questions
- Piracy
- Errata
- Downloading the example code
- Customer support
- Reader feedback
- Conventions
- Who this book is for
- What you need for this book
- What this book covers
- Preface
- Customer Feedback
- Why subscribe?
- www.PacktPub.com
- About the Reviewer
- About the Author
- Credits
- 版權信息
- 封面
- 封面
- 版權信息
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Why subscribe?
- Customer Feedback
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code
- Errata
- Piracy
- Questions
- Becoming Functional - Several Questions
- What is Functional Programming?
- Theory versus practice
- A different way of thinking
- What Functional Programming is not
- Why use Functional Programming?
- What we need
- What we get
- Not all is gold...
- Is JavaScript functional?
- JavaScript as a tool
- Going functional with JavaScript
- Key features of JavaScript
- Functions as First Class Objects
- Recursion
- Closures
- Arrow functions
- Spread
- How do we work with JavaScript?
- Using transpilers
- Working online
- Testing
- Questions
- Summary
- Thinking Functionally - A First Example
- The problem - do something only once
- Some bad solutions
- Solution #1 - hope for the best!
- Solution #2 - use a global flag
- Solution #3 - remove the handler
- Solution #4 - change the handle
- Solution #5 - disable the button
- Solution #6 - redefine the handler
- Solution #7- use a local flag
- A functional solution
- A higher-order solution
- Testing the solution manually
- Testing the solution automatically
- An even better solution
- Questions
- Summary
- Starting Out with Functions - A Core Concept
- All about functions
- Of lambdas and functions
- Arrow functions - the modern way
- Returning values
- Handling the this value
- Working with arguments
- One argument or many?
- Functions as objects
- A React+Redux reducer
- An unnecessary mistake
- Working with methods
- Using functions in FP ways
- Injection - sorting it out
- Callbacks promises and continuations
- Continuation Passing Style
- Polyfills
- Detecting Ajax
- Adding missing functions
- Stubbing
- Immediate invocation
- Questions
- Summary
- Behaving Properly - Pure Functions
- Pure functions
- Referential Transparency
- Side effects
- Usual side effects
- Global state
- Inner state
- Argument mutation
- Troublesome functions
- Advantages of pure functions
- Order of execution
- Memoization
- Self-documentation
- Testing
- Impure functions
- Avoiding impure functions
- Avoiding the usage of state
- Injecting impure functions
- Is your function pure?
- Testing - pure versus impure
- Testing pure functions
- Testing purified functions
- Testing impure functions
- Questions
- Summary
- Programming Declaratively - A Better Style
- Transformations
- Reducing an array to a value
- Summing an array
- Calculating an average
- Calculating several values at once
- Folding left and right
- Applying an operation - map
- Extracting data from objects
- Parsing numbers tacitly
- Working with ranges
- Emulating map() with reduce()
- More general looping
- Logical higher-order functions
- Filtering an array
- A reduce() example
- Emulating filter() with reduce()
- Searching an array
- A special search case
- Emulating find() and findIndex() with reduce()
- Higher level predicates - some every
- Checking negatives - none
- Questions
- Summary
- Producing Functions - Higher-Order Functions
- Wrapping functions
- Logging
- Logging in a functional way
- Taking exceptions into account
- Working in a more pure way
- Timing
- Memoizing
- Simple memoization
- More complex memoization
- Memoization testing
- Altering functions
- Doing things once revisited
- Logically negating a function
- Inverting results
- Arity changing
- Other higher-order functions
- Turning operations into functions
- Implementing operations
- A handier implementation
- Turning functions into promises
- Getting a property from an object
- Demethodizing - turning methods into functions
- Finding the optimum
- Questions
- Summary
- Transforming Functions - Currying and Partial Application
- A bit of theory
- Currying
- Dealing with many parameters
- Currying by hand
- Currying with bind()
- Currying with eval()
- Partial application
- Partial application with arrow functions
- Partial application with eval()
- Partial application with closures
- Partial currying
- Partial currying with bind()
- Partial currying with closures
- Final thoughts
- Parameter order
- Being functional
- Questions
- Summary
- Connecting Functions - Pipelining and Composition
- Pipelining
- Piping in Unix/Linux
- Revisiting an example
- Creating pipelines
- Building pipelines by hand
- Using other constructs
- Debugging pipelines
- Using tee
- Tapping into a flow
- Using a logging wrapper
- Chaining and fluent interfaces
- Pointfree style
- Defining pointfree functions
- Converting to pointfree style
- Composing
- Some examples of composition
- Unary operators
- Counting files
- Finding unique words
- Composing with higher order functions
- Testing composed functions
- Questions
- Summary
- Designing Functions - Recursion
- Using recursion
- Thinking recursively
- Decrease and Conquer: searching
- Decrease and Conquer: doing powers
- Divide and conquer: The Tower of Hanoi
- Divide and conquer: sorting
- Dynamic programming: making change
- Higher order functions revisited
- Mapping and filtering
- Other higher-order functions
- Searching and backtracking
- The Eight Queens puzzle
- Traversing a tree structure
- Recursion techniques
- Tail call optimization
- Continuation passing style
- Trampolines and thunks
- Recursion elimination
- Questions
- Summary
- Ensuring Purity - Immutability
- The straightforward JS way
- Mutator functions
- Constants
- Freezing
- Cloning and mutating
- Getters and setters
- Getting a property
- Setting a property by path
- Persistent data structures
- Working with lists
- Updating objects
- A final caveat
- Questions
- Summary
- Implementing Design Patterns - The Functional Way
- What are Design Patterns?
- Design pattern categories
- Do we need design patterns?
- Object-oriented design patterns
- Fa?ade and Adapter
- Decorator or Wrapper
- Strategy Template and Command
- Other patterns
- Functional design patterns
- Questions
- Summary
- Building Better Containers - Functional Data Types
- Data types
- Signatures for functions
- Other type options
- Containers
- Extending current data types
- Containers and functors
- Wrapping a value: a basic container
- Enhancing our container: functors
- Dealing with missing values with Maybe
- Monads
- Adding operations
- Handling alternatives - the Either monad
- Calling a function - the Try monad
- Unexpected Monads - Promises
- Functions as data structures
- Binary trees in Haskell
- Functions as binary trees
- Questions
- Summary
- Bibliography
- Answers to Questions 更新時間:2021-07-02 22:41:47