8 ms·
> No I'm using the mathematical definition of a function. Which mathematical definition? A "box" is not a mathematical definition. There are multiple mathemati
by bitdizzy 6y ago
> No I'm using the mathematical definition of a function.
Which mathematical definition? A "box" is not a mathematical definition. There are multiple mathematically precise definitions of "function" possible. Yours is none of them. Some of them accommodate objects that model mutable state.
I don't think many (any?) PL theorists or functional programming practitioners would agree with your dogmatic stance. Where are you coming from with all this?
- leafboi 6y agoI'm not having a dogmatic stance please stop voting me down. I'm tired of juniors who think they know what they're talking about. Just stop. https://www.wikiwand.com/en/Function_(mathematics) https://www.wikiwand.com/en/Function_(mathematics) That is the definition of a function. Quite complex. I simplified the explanation by using a Box. You will note in the wikipedia article they also have a picture of a Box with inputs and outputs. That is the essence of functional programming. Now please don't turn this into a immature pedantic argument about some obscure definition of a mathematical function. >I don't think many (any?) PL theorists or functional programming practitioners would agree with your dogmatic stance. Where are you coming from with all this? Uh they do (and it's not a dogmatic stance, the definition of FP is quite blurry, but immutability is universal). The point of functional programming hence the name is for the programming to follow mathematical functions as closely as possible. In the ideal world your program in FP is just one giant pure function that is a composition of other smaller functions. Of course your functions need to have side effects so they come up with all kinds of tricks or bend the rules a bit so that you can have things like IO and side effects but these are just exceptions to the rule. The philosophy of functional programming is to make your program as pure as possible and minimize or segregate side effects away from your program as much as possible. This is essentially what and all that Haskell is. Haskell uses a trick, a VM that takes an IO monadic Value and does side effects with it. Outside of that VM all the user does to the program is write Pure functions and compose them all together into a single function called Main. That's it. That's literally what haskell is, and if you think PL theorists don't agree with my "dogmatic" stance which is to say not "dogmatic" at all then you really don't know what you're talking about because Haskell is basically designed by the best in class functional PL theorists. Let me put it simply for you. If you can put your entire program in a single expression then you are doing functional programming. That is what functional programming is. There are no steps or procedures that happen one after the other. Every value is defined permanently. There's no concept of time or procedures in functions that's why you can't have variables getting assigned or mutated in FP. You can only define things in functional programming as they are right now without the concept of time in FP. Procedural programmers tend to create buckets of empty data variables to be filled in over clock cycles. If you don't get this, you don't understand functional programming. In an expression, you cannot mutate values you cannot have procedures or loops. Why do you think FP is loaded with recursion? If they allowed setters and getters and mutation like the example then we might as well add a jump command while your at it and suddenly we can use loops in functional programming. You just don't get it man. Dogmatic my ass, not even close.
- stopachka 6y agoYou have missed the point. It’s curious you think this piece is written by a “JavaScript programmer”, and the person who responded to you here is a “junior” — the implication being that you know more. It might help to take a step back and assume intelligence in others: what if these people are smart? What could you learn from them? If you think the idea is wrong, assume it’s coming from a peer. One way you know you are doing that, is if you form your disagreement as a question. — I took the time to respond to you, because it looks like you have some real love for programming, but know less than you think. You can grow a lot more if you shift some of your thinking
- leafboi 6y ago>You have missed the point. Tell me what you think the point is. Typically when someone thinks a point was missed they address the point rather than devolve the conversation into a condescending description about my character and how I should act. It's a sort of tactical what you're doing here. But who cares, no one is reading. It's curious how you don't even address my points and just say that I missed the point when I'm the one dictating the point in my original comment. Typically this isn't how you respect other people and get them to respond positively to your comments, what you're doing will draw other people to support you but anger your target because of the condescension. I'm not sure what you're objective is because people aren't really reading this thread... it's already buried. >It’s curious you think this piece is written by a “JavaScript programmer”, The examples in the original piece are in javascript. Why don't you RTFA before commenting on the "point." >and the person who responded to you here is a “junior” — the implication being that you know more. The Junior thing was more of a retort. I said it with full awareness of what it implies and how the other person would take it because his tone obviously implies that he doesn't think he's a junior. Basically the replier has his own opinion which he is entitled to say (and that I respect) but when you say things like "dogmatic" and then vote me down... that's just not respectful. Since I can't vote him down I inject a bit of subtle rudeness in my replies as a subtle retort in return. Just being a mirror. Similar in a way to the subtle game you're playing. That's all this is. >It might help to take a step back and assume intelligence in others: what if these people are smart? What could you learn from them? If you think the idea is wrong, assume it’s coming from a peer. One way you know you are doing that, is if you form your disagreement as a question. Maybe you should take a step back and look at your own post. Telling people to shift their thinking implies you have a sort of superiority complex. As if you're not the one that's mistaken. How do you know I'm not a peer? How do you know I'm not superior. Perhaps you should take a look at yourself. You seem like a guy who thinks he's superior to me in programming but you haven't demonstrated as much, you haven't even addressed the point. You went on a side tangent talking about my behavior. Trust me, if you want someone to change or listen to you, talking to them like this is not the path. You want to know what will make people respond to you and listen to you? Address them without any subtle disrespect. It's very simple. You could've responded to me like this: I disagree with you. I also think there was a misunderstanding of the point. Here's why... By proving the other person wrong without being disrespectful you can change the other person's' character. But obviously this isn't our objective here is it? That being said take a look at this wikipedia post and tell me. Who missed the point? https://www.wikiwand.com/en/Functional_programming https://www.wikiwand.com/en/Functional_programming "Functional programming is sometimes treated as synonymous with purely functional programming, a subset of functional programming which treats all functions as deterministic mathematical functions, or pure functions. When a pure function is called with some given arguments, it will always return the same result, and cannot be affected by any mutable state or other side effects. This is in contrast with impure procedures, common in imperative programming, which can have side effects (such as modifying the program's state or taking input from a user). Proponents of purely functional programming claim that by restricting side effects, programs can have fewer bugs, be easier to debug and test, and be more suited to formal verification.[1][2]" Literally that's the definition I'm following. It's one form of the definition and certainly a popular one. That's my opinion. You disagree? You think I missed the point? Elucidate. The original poster can disagree but my opinion is far from as he puts it "absurd." Read the article. What definition of functional programming does that class with a setter even fit under? Ok he redefined it as a higher order function... Is what he doing procedural programming or functional programming. It looks to me he's doing a bit of everything and calling it a function. Does the guy even know that the class keyword is just sugar for "function" in javascript? Look at this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Literally it says "classes" are just special functions. He's just reiterating the javascript spec as if it's a new fangled discovery. In fact, before ES6 all "classes" were written with the keyword "function." No dude. The article writer doesn't get it and neither does the person who responded to my post. When you do OOP with LISP you're not doing FP period. The article writer just noticed an isomorphism and is likely amazed by what all JS programmers were doing before ES6. Not to be insulting but the parent poster likely doesn't have much experience. >I took the time to respond to you, because it looks like you have some real love for programming, but know less than you think. You can grow a lot more if you shift some of your thinking I too took the time to respond to you. Despite your condescending attitude/game. Let's see where this goes.