Composition - Deepstash
Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Machine Learning With Google

Discover 95 similar ideas in

It takes just

14 mins to read

Composition

This is a method where we take simple functions and combine them into a more complex function. Let's say we have two methods f(x) = x * 2 //(timesTwo) and f(x) = x - 1 // (minusOne) . And we want to compute f(x) = 2x -1 . You call the timesTwo function first. With the output of timesTwo , you call the minusOne function. How would you code this?

The requirement here is that the next function takes as argument the same type that the previous function returns.

21

99 reads

MORE IDEAS ON THIS

Immutability

Remember how we assign different values to a variable through out the program? How we use setters in classes to modify the value of class variables? That is not allowed in FP. A variable once set remains unchanged. Sort of like, making all variables final.We usually think of variable...

21

170 reads

What Is Functional Programming

What Is Functional Programming

Funcational Programming is a declarative way of programming.

21

495 reads

Partial Application

Let's say there is a function that takes three arguments. Usually, we need to be aware of all three values to call this function, right? In partial application, the three arguments are provided at different times. I could not find a decent blog that explains this well.

21

114 reads

First Class Function

In OOP we treat data and functions separately. In FP, they are all the same. We can create an array of functions, pass a function as argument, return a function from a method.

20

179 reads

Recursion

Recursion is when a function calls itself and an end condition exists in the function to stop the method call. We could talk about this in depth another day. For now, here is a good explanation.

20

116 reads

Functional Purity

If a function returns same value for the same argument every time, then the function is pure. That generally means that, the function cannot use any state values that could potentially change.

21

169 reads

CURATED FROM

CURATED BY

Not your object oriented programming

Related collections

More like this

Running the Action Tree

Once we have the action tree, running the code is easy. Each action node has a function ‘execute’ which takes some input, does whatever the action should (including possibly calling sub action) and returns the action’s output. This is the interpreter in action. 

Learning Python: More on printing and variables

Learning Python: More on printing and variables

In this part we will be going over more on variables and printing them.

So let's make a variable and give it the value of 10, so it should look something like this X = 10, X could be any word really just not a reserved word, here is a link to a website with alot of reserved words that can't...

Ethereum is the Excel of Blockchains

Bitcoin is a database that does only 1 thing: track ownership of coins.  Ethereum adds the computational capabilities that makes Excel more than a database: 

  • Turing Completeness. It means that it can solve any computational problem. With the introduction of formulas, E...

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates