d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Methode Chaining And Higher Order Functions > Similar Or Different?
Add Reply New Topic New Poll
Member
Posts: 2,940
Joined: Aug 23 2011
Gold: 1,080.37
Jul 14 2019 11:15am
ty
Member
Posts: 8,992
Joined: Mar 24 2013
Gold: 18,115.00
Jul 14 2019 02:40pm
absolutely different
Member
Posts: 2,940
Joined: Aug 23 2011
Gold: 1,080.37
Jul 14 2019 05:19pm
Was telling a friend about higher order functions and map-reduce, and graph databases (data structures and trees etc). After he asked if you could run sql querries from js (nodejs that is ofc). Like in one of the chapters of the eloquent javascript book is explained. And as in functional programming in lisp etc.
And he said its like methode chaining in c#. And i was like hmm. Dont remember exactly. But not sure that it is. After just 5 minutes quick googling havent yet found satisfactory explanation i could wrap my head around. Thats why asking.

Later i had a tought that maybe i explained it not exactly right to him. And that led to confusion. But then i also believe that some complex/avanced topics, like for exemple some abstract programming topics, cant be explained. You just have to figure it out yourself. Or maybe he just couldnt care less. :D

Care to elaborate?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 14 2019 07:34pm
Quote (BlueHat @ Jul 14 2019 07:19pm)
Was telling a friend about higher order functions and map-reduce, and graph databases (data structures and trees etc). After he asked if you could run sql querries from js (nodejs that is ofc). Like in one of the chapters of the eloquent javascript book is explained. And as in functional programming in lisp etc.
And he said its like methode chaining in c#. And i was like hmm. Dont remember exactly. But not sure that it is. After just 5 minutes quick googling havent yet found satisfactory explanation i could wrap my head around. Thats why asking.

Later i had a tought that maybe i explained it not exactly right to him. And that led to confusion. But then i also believe that some complex/avanced topics, like for exemple some abstract programming topics, cant be explained. You just have to figure it out yourself. Or maybe he just couldnt care less. :D

Care to elaborate?


function chaining is calling a function on the result of a function call. if you write them on separate lines, they do exactly the same thing. eg:

new PracticeDummy().beatWithStick().beatAgain().kickAround();

is the same as:

PracticeDummy myPracticeDummy = new PracticeDummy();
myPracticeDummy = myPracticeDummy.beatWithStick();
myPracticeDummy = myPracticeDummy.beatAgain();
myPracticeDummy = myPracticeDummy.kickAround();

Does this look like an example of using higher order functions?

if he's a C# guy, tell him to look at LINQ. for example, WHERE operates on a predicate.
Member
Posts: 2,940
Joined: Aug 23 2011
Gold: 1,080.37
Jul 15 2019 02:34am
Ok ty

In fact almost every time i tell him about functional programming he brings up linq.

I found this video as first or second search result

Explaining Higher Order Functions and Method Chaining - YouTube

I guess if you think in c# its not the same as if you had studied a little lisp.
Member
Posts: 2,940
Joined: Aug 23 2011
Gold: 1,080.37
Jul 15 2019 05:25am
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll