Ask coding questions

← Back to all posts
Functional Programming
Smart0ne (749)

What is functional programming? I still don't get it after searching it up ... like what do you mean by "minimizing the side effects"?

Answered by Coder100 (18882) [earned 5 cycles]
View Answer
Coder100 (18882)

Functional programming is when everything is a function. It is really hard to explain without you learning it.

I recommend learning F#, which is a functional programming language.

Side effects are like print("hi"). This is not a pure function, because if another function was trying to read the results of the terminal, it would vary depending on if you called that function or not.


next time please actually search these questions up

Smart0ne (749)

@Coder100 But ... how can everything be a function? These functions won't be called? (ah, the standard answer: LEARN F#)

Coder100 (18882)

@Smart0ne well, the plus operator is secretly a function too:

5 + 6

turns into:

(+) 5 6

where (+) is the literal name for the function xd

Coder100 (18882)

just learn a functional language and you will understand @Smart0ne

Coder100 (18882)
let markAsCorrectAnswer = true


Baconman321 (1103)

@Coder100 It doesn't just have to be a language where everything is a function. JavaScript could be partially converted into a functional language. Instead of using a for loop, you could use a forEach loop, or something of the sort. But, typically yes it is where things are converted into a function. This is based off of my understanding, so excuse me if I'm wrong.

aa2dee2 (12)

Start with Elixir (backbone of Discord). I've started a series of tutorials for beginners. Part 1 here

ReferenceError (1)

Functional Programming is the future. More efficient code, less clutter. Basically everything is bound to functions. no more while or for.

Baconman321 (1103)

Functional programming is a paradigm where you program using functions. Like instead of using a for loop in JavaScript, you use the function forEach().