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.