Reputation: 613 Enlightened
- Expert w/DIC++
- Active Posts:
- 2,833 (1.09 per day)
- 05-January 09
- Profile Views:
- Last Active:
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
- Expert In:
- Functional Programming
Posts I've Made
Posted 19 Mar 2014LAMBDAS. GIMME.
Posted 17 Mar 2014With Pure Functions you cant do anything. IOMonad any one?
Input and Output involves mutable state.
Two things here.
First of all, why is this relevant to this discussion? Is it entirely necessary? It's the kind of pointless nonsense I was talking about in my previous post.
Secondly, I mean absolutely no offense by this, but you do not know what you're talking about in this case. Monads are one method with which to isolate IO. You can do input and output just fine in Haskell, which is a purely functional programming language. It's wrapped in the IO monad as a way to isolate and manage side effects. Read the answer here: https://stackoverflo...e-io-monad-pure
I can happily provide more resources if this is unclear, but how Haskell does IO and still remains purely functional is a commonly asked question and thus is easily googleable.
Your next question is likely "HAH! BUT IF I CAN DO IO THEN WHAT DOES IT MATTER?". Well, monads isolate side effects so that side effectful code is clearly separated from pure code. You assert that with pure functions "you can't do anything", but that's clearly false and can be proven so by browsing the code inside the Haskell package list, which has libraries and programs for most things you could imagine. The only reason that most of the code we write in imperative languages is tangled up in side effects is because we don't have Haskell's type system forcing us to write our code as purely functional pieces inside of a thin IO layer. It's more about how you structure your code than anything. You can do the same thing in most languages that give you a few foundational tools -- it's just that Haskell is designed around it and forces it on you.
I never said it was / wasn't.
Question, Any OS written total written in purely functional language?
Posted 17 Mar 2014I loathe these articles, threads, and everything relating to this concept that you should learn certain languages and a certain number of languages because REASONS.
I'm an advocate for functional programming. Why? Because it's another tool in the toolbox, and it's one that a lot of people walk right past as if it weren't there and any person who has actively put effort forth to write code in a functional style, or has used a language like Haskell for any remotely substantial portion of work, will tell you this. It's not about "functional programming is better because of x". It's just another tool. Lots of problems are elegantly represented in functional style, some more elegantly represented in other ways.
Finally, I think that if we spent 70% of the time we spend bitching about which languages we should learn instead actually learning and hacking with some unfamiliar languages, we'd all benefit from it substantially, as would the quality of these discussions. I swear, if I see another debate on whether or not FP is "academia" I'm going to just explode to pieces. I've spent the vast majority of my career writing code in Clojure for a living. Recently got a new job and write Python for a living. Tools. They're tools. I use them to get work done the best way I can.
Furthermore, guess what happened when I and a coworker suggested we use Clojure for some potential future projects? Screaming and employees running with fear? Nope, interest and excitement. At the very least, startups are embracing new technologies. I attended a meetup at Whisper recently. They use Erlang and Elixir, and you can be sure that they can justify why.
They're just tools and if you *can* learn a new tool, you should probably do it.
As an aside, I'm unclear what baavgai means by asserting that imperative languages are easier to debug. I'd assert the opposite, that languages (and even just code written in such a style) that focus on immutable values and referential transparency are in fact more or less *designed* to be easier to debug. For pure functions you can more or less just write a unit test covering your inputs and it will be pretty guaranteed to work. Throw in some state and who knows what's going to go down.
- Member Title:
- D.I.C Lover
- 22 years old
- February 2, 1994
- Los Angeles
- Functional programming, programming in general, writing, music, etc.
- Forum Leader:
- Functional Programming
- Full Name:
- Anthony Grimes
- Years Programming:
- Programming Languages:
- Clojure, Haskell, Ruby, Python, Go, Elixir
- [email protected]
I X Code X 1