0
Please why is my code not working,do I need to install any library
Recently started functional programming and all explanations of the pipe and compose using reduce which I have seen are very sketchy. https://code.sololearn.com/WZurf7Iml396/?ref=app
18 ответов
+ 2
use pydroid and install it with pip
0
This seems like advanced stuff, But you're using simple vars. You need to be making functions so you can create the function compositions.
https://itnext.io/write-better-javascript-function-composition-with-pipe-and-compose-93cc39ab16ee
0
I really don't get you Chris ..what is simple vars?
0
I understand the process it's just getting the code to work that has been my problem
0
So you understand the difference between variables and functions?
0
Functions can also be expressed as variables or am I wrong?
0
So in your example where are your functions? You have stored something in the variables but what you have stored are not functions.
0
Theres a few issues, my friend.
First remove the var x = 4, and you need to change your subtract, multiply and add into functions i would recommend you use arrow notation for this.
Second your pipe statement must be delcared with const pipe =
Third in your pipe statement you used functions and function which is a reserved keyword in JS change these to something else like funcs and func
Lastly in the result remove the 4, then console.log(result(4))
Give it a try, if you still stuggle drop a reply and I’ll help further
0
steve Purpose This is what made it click for me. Honestly I have not used function composition until I read your post, lol.
https://javascript.plainenglish.io/a-working-example-of-function-composition-in-javascript-5e8c704a13ca
0
Nice at Chris..I'll go through it.. compose and pipe is looking like the hardest thing for me since I started programming last December.
0
Oh forgot this one it has an illustration.
https://www.educative.io/edpresso/function-composition-in-javascript
0
✌️😀 You deserve a coffee
0
What's funny and annoying is that the corrections you showed ,was the initial code I wrote but it kept returning errors and now I changed it back and it worked
0
Yeah I know about Ramda..Thanks all the same..we got it solved.
0
Underscore I run sololearn on Android..My pc currently has an issue..Can I run Ramda on my Android?
0
keep it running
0
Bob_LI I can no longer find the Ramda link you sent to me.