Live data from Hacker News

Why I Prefer Functional Programming

haskellforall.com

111–120 of 129 posts

Re: Why I Prefer Functional Programming

#111
post #110

Earlier quoted context omitted.

>You're just trolling at this point. Please reconsider your confidence in this material, because you are egregiously mistaken. Why the heck would I run such a long expose and troll you and be mistaken at the same time. >How does this Haskell program write to stdout if it doesn't mutate memory? Let's not be stupid here. Every program on the face of the earth must mutate memory because that's how computers work. Assemb…

>What variable or data was mutated within haskell? The stdout buffer. Just because mutation isn't explicit doesn't mean it isn't there. Programming languages are not syntax devoid of meaning: they have semantics. What happens at runtime is part of what a programming language does. (Arguably, that is the most important part of what they do.) >What this means is that imperative primitives must exist for any programming…

>The stdout buffer.

The stdout buffer is not part of the haskell language, it is part of the OS. The haskell runtime reads the haskell language and accesses the buffer. Neither the runtime or the buffer is part of the haskell language, get it? That's why haskell is called "pure" Category Hask: https://wiki.haskell.org/Hask#:~:text=Hask%20is%20the%20cate....

>Just because mutation isn't explicit doesn't mean it isn't there.

So? I never said it wasn't there. I'm basically saying as far as the programmer is concerned when operating within the haskell language no haskell language primitive is mutating. stdout buffer is not a haskell primitive... it is an OS primitive.

>That's completely untrue. Imperative languages can be implemented as a subset of functional ones[1] and vice versa.

This is true theoretically, but physically but you can't actually build a functional machine. Lisp isn't actually a functional language and you'll see from the instruction primitives that the lisp machine is more or less a turing machine that mutates memory.

>No language can do anything if it isn't implemented in a machine.

So? Never said this wasn't true.

>A machine isn't "imperative"[2], it's a pile of atoms that do what atoms do, without paradigm or instruction.

The machine you build is limited by what you build it with. You have a limited set of atoms. Therefore you can only build a machine with limited amount of state. In order to use the state efficiently the state must be mutable. Mutable state means imperative instructions. You can imitate functional programming with such a machine and you can sort of solve the memory problem with garbage collection. But with what paradigm do you implement the garbage collector? Imperative primitives.

> The reason nobody has, is because it doesn't matter: any Turing complete language can be used to implement any other language[3].

No the real reason is also because it's physically impossible. A physical translation of a actual lambda machine cannot be realized. What they can make is register based machine that are more efficient at compiling certain functional languages that's it. All machines we build have some sort of state that changes.

>Don't assert it, Prove it. Show me one computable function that cannot be computed using boolean algebra.

Sure I can prove what I said. But you're changing the problem from IO and ST to a computable function which I assume is algebraic. So of course all of algebra can be used to create all algebraic functions. I'll just prove what I said rather than what you changed it to.

Assuming mutation is an axiomatic operation that cannot be built from immutable operations, you will see that no mutation operation exists in algebra indicating that mutation cannot ever exist in any theorem of algebra:

https://www.wikiwand.com/en/Algebraic_operation#:~:text=In%2....

You will see that no algebraic operation involving mutation exists in the above document.

>Try to implement `volatile` in C without using another language. Does that mean C fails to model real hardware? No, because it has `volatile` to get volatile semantics! Just like Haskell has IO to get I/O side-effects. Or ST to get mutation semantics.

No but I can implement volatile with imperative primitives from other languages. All I am saying is you cannot implement ST and IO with functional primitives.

Re: Why I Prefer Functional Programming

#112

Earlier quoted context omitted.

No it's not that. Even in posts where I just state logical reasons for disagreement I get voted down in this thread. People vote down what they disagree with, if they agreed with me, most peoples' biases would usually find my attitude appropriate. If I said something like logically I feel a certain race is inferior genetically. People will vote that statement down purely out of disagreement and misinterpret it as an…

I've been here for seven years. You've been here for a month (at least with these accounts). And you're telling me why you're getting downvoted. I'm trying to help you. You're not listening.

I've been here for over 10. I've had accounts with lots of karma generated by simply agreeing with everything I read or just commenting with useless side suggestions. T

I've experimented a lot. Without changing tone just disagreeing with a popular opinion is all that you need to get voted down. I've even experimented with emotionally charged impolite popular opinions. People will vote you up just because they agree.

If I wanted a shitload of karma. I know how to get it. Removing one or two of the more "expressive" sentences above will in my experience not do much for a thread that is very very biasedly supporting FP. FP is great, I prefer it but most people cannot maintain such neutrality for their favorite paradigm. Or favorite anything for that matter.

Not to mention if you recall a while back someone posted a GPT-3 AI generated story that got voted to the front page. Most commenters didn't realize it was AI generated. A select few were able to figure it out and they posted comments that were vehemently voted down for not being in agreement with the general sentiment. HN is a technical crowd but they are not above common mob behavior.

https://www.theverge.com/2020/8/16/21371049/gpt3-hacker-news...

Scroll down to the picture. The person stated facts but his facts were misinterpreted to be attacks and he was told to be civil by someone who thought of himself as level headed. The reality is that the levelheaded person is as biased as one can get.

You think you're helping me. You think I'm putting up stubborn resistance to your help. Is that the case or am I just simply describing to you some of the insight I've gotten from messing around with HN for over a decade? Did I in fact put up stubborn resistance or am I just conversing with you and stating a disagreement? Hard to say.

Your immediate assumptions are no different than the "levelheaded" dude from earlier. Let's just be clear, I'm fully aware of the "expressive" areas in my posts.

You will also note that many of the posters assumed I'm attacking FP and that I don't have much experience with FP. All wrong assumptions. I have lots of experience and I prefer FP over other paradigms. I am simply stating that I disagree with the fact that algebra is the future of programming and can replace all imperative programming.

Re: Why I Prefer Functional Programming

#113
post #110

Earlier quoted context omitted.

>What variable or data was mutated within haskell? The stdout buffer. Just because mutation isn't explicit doesn't mean it isn't there. Programming languages are not syntax devoid of meaning: they have semantics. What happens at runtime is part of what a programming language does. (Arguably, that is the most important part of what they do.) >What this means is that imperative primitives must exist for any programming…

>The stdout buffer. The stdout buffer is not part of the haskell language, it is part of the OS. The haskell runtime reads the haskell language and accesses the buffer. Neither the runtime or the buffer is part of the haskell language, get it? That's why haskell is called "pure" Category Hask: https://wiki.haskell.org/Hask#:~:text=Hask%20is%20the%20cate... . >Just because mutation isn't explicit doesn't mean it isn't…

>Mutable state means imperative instructions.

It does not. I don't know where you got that idea, or why you just keep repeating it, but at this point your thoughts on the matter aren't worth reading, so lets consider this discussion tabled. I won't be reading anymore of your posts on it.

Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to find yourself a competent computer scientist to aid you in framing your ideas in a way that is comprehensible with respect to the subject matter.

You don't have to listen to me, but you should seek out a second opinion from a competent person who can get through to you.

EDIT: Apparently, asking someone to get their opinion checked by someone who isn't a crank is a personal attack. HN, you need me more than I need you. Ban away, mods.

Re: Why I Prefer Functional Programming

#114

Earlier quoted context omitted.

I've been here for seven years. You've been here for a month (at least with these accounts). And you're telling me why you're getting downvoted. I'm trying to help you. You're not listening.

I've been here for over 10. I've had accounts with lots of karma generated by simply agreeing with everything I read or just commenting with useless side suggestions. T I've experimented a lot. Without changing tone just disagreeing with a popular opinion is all that you need to get voted down. I've even experimented with emotionally charged impolite popular opinions. People will vote you up just because they agree.…

You've been here for over 10 years, under various accounts, but you don't know that people can't downvote direct replies? Not quite sure I believe that.

Re: Why I Prefer Functional Programming

#115
post #113

Earlier quoted context omitted.

>The stdout buffer. The stdout buffer is not part of the haskell language, it is part of the OS. The haskell runtime reads the haskell language and accesses the buffer. Neither the runtime or the buffer is part of the haskell language, get it? That's why haskell is called "pure" Category Hask: https://wiki.haskell.org/Hask#:~:text=Hask%20is%20the%20cate... . >Just because mutation isn't explicit doesn't mean it isn't…

>Mutable state means imperative instructions. It does not. I don't know where you got that idea, or why you just keep repeating it, but at this point your thoughts on the matter aren't worth reading, so lets consider this discussion tabled. I won't be reading anymore of your posts on it. Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to fi…

Personal attacks are against site rules on HN. You are clearly across the line here. Moderators ban people for repeated violations, so if you want to continue here, you should stop posting abuse.

Re: Why I Prefer Functional Programming

#116
post #113

Earlier quoted context omitted.

>The stdout buffer. The stdout buffer is not part of the haskell language, it is part of the OS. The haskell runtime reads the haskell language and accesses the buffer. Neither the runtime or the buffer is part of the haskell language, get it? That's why haskell is called "pure" Category Hask: https://wiki.haskell.org/Hask#:~:text=Hask%20is%20the%20cate... . >Just because mutation isn't explicit doesn't mean it isn't…

>Mutable state means imperative instructions. It does not. I don't know where you got that idea, or why you just keep repeating it, but at this point your thoughts on the matter aren't worth reading, so lets consider this discussion tabled. I won't be reading anymore of your posts on it. Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to fi…

https://www.wikiwand.com/en/Imperative_programming

"In computer science, imperative programming is a programming paradigm that uses statements that change a program's state."

You will see from the quotation above. The very act of changing state is an imperative style by definition. The purpose of mutable state is for it to change. So mutable state = imperative instructions.

>You don't have to listen to me, but you should seek out a second opinion from a competent person who can get through to you.

I'll throw that advice back at you. But you don't need to find that person. I'm right here in front of you telling you how it is.

>Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to find yourself a competent computer scientist to aid you in framing your ideas in a way that is comprehensible with respect to the subject matter.

Yeah but you didn't account for the practical parts of computing. The theoretical parts often deal with machines that can't be realized in reality. It's pretty much common sense. How do you represent a function call without mutable state? How can you have a machine do an algebraic operation without mutable state? The very act of holding that information in state requires a state change meaning to even load a lambda machine with a program requires an imperative instruction.

We're also in a corner of computer science that isn't formally well defined. A language can be formally defined as pure but there's no formal theory for systems design and how the system overall influences the content of a pure SQL string in Haskell.

I define a haskell sql string to have syntactically correct SQL. The external requirements of my database are forcing me to define a string this way, is that a side effect? There's no formal rules in literature so it's just raw talking points... you won't be able to find an official source stating who's right or who's wrong.

Re: Why I Prefer Functional Programming

#117

Earlier quoted context omitted.

I've been here for over 10. I've had accounts with lots of karma generated by simply agreeing with everything I read or just commenting with useless side suggestions. T I've experimented a lot. Without changing tone just disagreeing with a popular opinion is all that you need to get voted down. I've even experimented with emotionally charged impolite popular opinions. People will vote you up just because they agree.…

You've been here for over 10 years, under various accounts, but you don't know that people can't downvote direct replies? Not quite sure I believe that.

Welp most of my accounts don't have much karma to even downvote. I have some that went past 800 but I abandoned them because I like to tell people how I disagree.

Re: Why I Prefer Functional Programming

#118
post #113

Earlier quoted context omitted.

>Mutable state means imperative instructions. It does not. I don't know where you got that idea, or why you just keep repeating it, but at this point your thoughts on the matter aren't worth reading, so lets consider this discussion tabled. I won't be reading anymore of your posts on it. Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to fi…

Personal attacks are against site rules on HN. You are clearly across the line here. Moderators ban people for repeated violations, so if you want to continue here, you should stop posting abuse.

You can do better, then. Read nendroids latest reply to me, and help them understand that it's the "use of statements" that makes a language imperative, not the "modification of state."

I won't be responding, and they seem to think they're quite the expert in this sort of thing.

Re: Why I Prefer Functional Programming

#119
post #113

Earlier quoted context omitted.

>Mutable state means imperative instructions. It does not. I don't know where you got that idea, or why you just keep repeating it, but at this point your thoughts on the matter aren't worth reading, so lets consider this discussion tabled. I won't be reading anymore of your posts on it. Everything I said in my last post is basic, well-understood computing knowledge. If you want me to disagree with it, you need to fi…

Personal attacks are against site rules on HN. You are clearly across the line here. Moderators ban people for repeated violations, so if you want to continue here, you should stop posting abuse.

I see no personal attack. Technically speaking.

Re: Why I Prefer Functional Programming

#120
post #118

Earlier quoted context omitted.

Personal attacks are against site rules on HN. You are clearly across the line here. Moderators ban people for repeated violations, so if you want to continue here, you should stop posting abuse.

You can do better, then. Read nendroids latest reply to me, and help them understand that it's the "use of statements" that makes a language imperative, not the "modification of state." I won't be responding, and they seem to think they're quite the expert in this sort of thing.

"In computer science, imperative programming is a programming paradigm that uses statements that change a program's state."

The above quote is ripped straight out of wikipedia's definition of imperative programming showing that what I said wasn't a misunderstanding but an official definition.

The definition of imperative programming must include mutation otherwise it's isomorphic to functional programming. Because functional programming is simply statements without mutation.

Post reply on HN