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

14th May 2022, 10:46 PM
steve Purpose
steve  Purpose - avatar
18 Answers
+ 2
use pydroid and install it with pip
16th May 2022, 12:01 AM
underscore
underscore - avatar
15th May 2022, 12:27 AM
Chris Coder
Chris Coder - avatar
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
14th May 2022, 11:38 PM
Chris Coder
Chris Coder - avatar
0
I really don't get you Chris ..what is simple vars?
14th May 2022, 11:41 PM
steve Purpose
steve  Purpose - avatar
0
I understand the process it's just getting the code to work that has been my problem
14th May 2022, 11:44 PM
steve Purpose
steve  Purpose - avatar
0
So you understand the difference between variables and functions?
14th May 2022, 11:59 PM
Chris Coder
Chris Coder - avatar
0
Functions can also be expressed as variables or am I wrong?
15th May 2022, 12:02 AM
steve Purpose
steve  Purpose - avatar
0
So in your example where are your functions? You have stored something in the variables but what you have stored are not functions.
15th May 2022, 12:12 AM
Chris Coder
Chris Coder - avatar
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
15th May 2022, 12:26 AM
Amaani
Amaani - avatar
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
15th May 2022, 12:47 AM
Chris Coder
Chris Coder - avatar
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.
15th May 2022, 12:47 AM
steve Purpose
steve  Purpose - avatar
15th May 2022, 12:54 AM
Chris Coder
Chris Coder - avatar
0
✌️😀 You deserve a coffee
15th May 2022, 5:48 AM
steve Purpose
steve  Purpose - avatar
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
15th May 2022, 6:06 AM
steve Purpose
steve  Purpose - avatar
0
Yeah I know about Ramda..Thanks all the same..we got it solved.
15th May 2022, 4:20 PM
steve Purpose
steve  Purpose - avatar
0
Underscore I run sololearn on Android..My pc currently has an issue..Can I run Ramda on my Android?
16th May 2022, 1:42 AM
steve Purpose
steve  Purpose - avatar
0
keep it running
16th May 2022, 11:44 AM
JSON🌠
0
Bob_LI I can no longer find the Ramda link you sent to me.
16th May 2022, 12:53 PM
steve Purpose
steve  Purpose - avatar