r/functionalprogramming • u/Enough_Ad2099 • Jun 13 '23
Scala The Business of the Scala Programming Language with John A. De Goes
r/functionalprogramming • u/Enough_Ad2099 • Jun 13 '23
r/functionalprogramming • u/IAmBlueNebula • Mar 25 '23
I'm one of those code monkeys who loves to code, to develop software and to tinker with it, but is not really interested in math.
I'm addicted to code, both in imperative and in functional/declarative style. The functional programming world feels conceptually superior to me: it offers better abstractions and the community is much more knowledgeable on average. However an issue I have with it, is how mathy it is. I'm not afraid of Greek letters, but most material about FP seems to target math majors who are new to programming. Instead of leveraging my passion and the knowledge I already have, it explains stuff in a way I neither understand or enjoy. I understand that the "conceptual superiority" probably correlates with math, and I appreciate that you developed all those beautiful theories; but I'm not interested in them myself.
Anyways. With mainstream FP languages like Haskell, a well determined code monkey is able to find their way and learn whatever they need, with a little bit of efforts. But recently I've developed a curiosity about Dependent Types, and that path feels unapproachable. For absolutely no reason.
I've seen how one can use Dependent Types to implement a first-class type-safe printf without any tricks. And I love that shᴉt. And DTs seem to have so many other cool tricks up their sleeves that are great for the kind of general-purpose programming I do: a brilliant solution to coherence; a better version of type families/type level programming; and who knows what else.
However a code monkey like me can't simply approach DTs. I'm trying to learn some Agda, but everything is about proofs. I really couldn't care less about proving. I understand how important it is; I understand why DTs and proving are tightly related; but I just neither enjoy nor care about it at all. I just want to understand whether they can turn some of my void* or template-template-parameters into something nicer.
With this aimless rant I have two goals. 1. I'd love to start a conversion about code-monkey awareness: many others from my troop would venture into your cities if the approach I'd call bottom-up (from pointers to higher-order abstractions) was more readily available: the top-down approach (from mathematical concepts to code) scares many of us away. 2. How can I leverage my programming-language polyglottony to understand Dependent Types without hearing about a proof ever again?
r/functionalprogramming • u/Fabus1184 • Feb 10 '23
To be very clear, this means a compiled, statically-typed, non-garbage collected language with direct memory access and a fixed evaluation order that does not require any runtime system. I read multiple posts/comments saying it would be difficult or impractical. Still, I don't see why a declarative language wouldn't be able to solve that in an elegant way.
Think of something like this arbitrary Haskell-C-Mix:
doubleEach :: int32* -> int32 -> IO ()
doubleEach array 0 = pure ()
doubleEach array n = do
x <- readInt32 array
writeInt32 array (x * 2)
doubleEach (array + 1) (n - 1)
main :: IO ()
main = do
array <- malloc (100 * sizeof int32)
when (array == NULL) $ error "malloc failed"
mapM_ (í -> writeInt32 (array + i) i) [0 .. 99]
doubleEach array 100
mapM_ (\i -> readInt32 (array + i) >>= print) [0 .. 99]
free arraySuch a language should be able to compile without a RTS or garbage collection and could be used virtually everywhere C is used. You could even make memory-safe programs eg. by using arrays with type-level lengths.
Admittedly there are a few gotchas like closures with references to stack-allocated variables and stuff, but nothing that couldn't be solved.
Why does this not exist, it seems like such a powerful language?
r/functionalprogramming • u/Voxelman • Jun 11 '22
I always wonder how FP works for applications that rely heavily on IO. I work in a company that makes temperature controllers, and we have machines that are used to test and calibrate them. The calibration program that runs on the machine does almost nothing but IO, such as communicating with the measurement devices or power supplies, communicating with a database, or simply updating the screen. There is not much "business logic" that can be executed in a purely functional way.
How does FP fit in this environment? Is there a pattern that can be used or are non FP languages better for this kind of job?
r/functionalprogramming • u/plsdontkillmee • Apr 29 '22
every tutorial i've seen about functional languages is made for people who already know imperative languages very well, and they also get into the more complex things very quickly. so I'm just wondering why functional languages aren't usually people's first language
r/functionalprogramming • u/dredozubov • Nov 03 '21
r/functionalprogramming • u/kinow • Sep 26 '21
r/functionalprogramming • u/kinow • Apr 01 '21
r/functionalprogramming • u/viebel • Jan 31 '21
Data-Oriented programming is a new book from Manning Publications that has just entered MEAP with only three chapters ready.
There are three main principles behind this book:
it is language agnostic (applicable Java, C#, JavaScript, Ruby, Python, Clojure...)
it is practically oriented
it is fun to read
You may find additional information about the book and its content in the freely available chapters. Get 50% off with the discount code mlsharvit2 valid through February 14.
I am the author and I'd be glad to answer any questions regarding this book.
r/functionalprogramming • u/binaryfor • Nov 24 '20
r/functionalprogramming • u/MaoStevemao • May 28 '20
r/functionalprogramming • u/cekrem • Jan 05 '26
https://cekrem.github.io/posts/functors-applicatives-monads-elm/
Do you generally agree with this? It's a tough topic to teach simply, and there's always tradeoffs between accuracy and simplicity... Open to suggestions for improvement! Thanks :)
r/functionalprogramming • u/daedaluscommunity • Jan 16 '23
r/functionalprogramming • u/kinow • Jun 26 '21
r/functionalprogramming • u/dat-lambda • Apr 12 '21
I have first learnt some programming with C++ many years ago, it was very casual and informal. I didn't study CS. Some years ago I have returned to programming because of my work and since there were a ton of high quality resources for Scheme, Lisp, Racket, Haskell and likes I got interested in Functional Programming, it was my first structured and serious study of CS concepts. Right now I am working through SICP, use Scheme whenever I can and Python when I need its ecosystem.
My problem is that when I write Python I tend to write in very imperative C like way. Of course I try to use FP ideas as much as possible, break things down to small functions etc. But there are a lot of cases when I write C like code when I need to use Python side-efectfull things. I think if I would understood OOP I could write much better code. And there are also some domains where OOP is still good or I need to work together with other programmers.
My problems is that while there are tons of high quality stuff for FP (SICP, HTDP, Scheme interpreters, functional data structures, Ocaml from very beginning, introductury Haskell books, macros in Lisp, Elixir, SML and I could go on and on, there are literaly tons of super quality materials) the stuff for OOP seems super dumbed down.
I think probably because OOP is usually studied in universities there is less need for some other material (??) but still. 99% of examples (even in books) are like this:
Here is dog class.
Dog can bark.
There is also a cat.
They both belong to animal class.
There are also metaclasses but you should never really touch them.
End of tutorial.
_____________________________
Like how does that even teach you anything ? Why would dog be a class ? What is the idea behind doing this ?
I am not saying that I read all those FP books. I have read much less than I would want and I am very time constrained. But could you guys point me to some proper resources on OOP ? I believe that many FP folks have better understanding on fundamental topic, this is why i ask on this subreddit.
r/functionalprogramming • u/MaoStevemao • Feb 29 '20
r/functionalprogramming • u/emotional-bear • Dec 23 '19
r/functionalprogramming • u/kinow • Feb 13 '18
r/functionalprogramming • u/Best-Repair762 • Dec 30 '25
I completed Martin Odersky's course "Functional Programming Principles in Scala" in around 2015. That course was my only introduction to functional programming and the new ways in which it makes you think. I did not follow up on learning more FP after that except for some dabbling in Haskell which I've mostly forgotten.
If I wanted to restart from the basics - today - what are some good suggestions for courses?
My programming experience has been with Java, Python, JavaScript/TypeScript, and a bit of Ruby and Go. I have found that hands-on courses work best for my learning style, hence the request for courses (either videos or lecture notes with assignments).
r/functionalprogramming • u/Voxelman • May 29 '25
Almost every Linux distribution has Python installed by default.
Is there a functional language that could eventually replace Python as the standard?
I think it should be a dynamically typed and interpreted language that, if possible, does not require Javascript or similar platforms in the background.
Potential candidates: Clojure (requires JVM) Elixir (requires Beam) Racket GNU Guile (not very common) F# (requires .NET and is statically typed) Purescript (but requires JavaScript)
Syntactically F# would be the best alternative and with fsx files Scripting is as simple as in Python. And because of the great type inference it might be as easy as Python. The only obstacle is the requirement for .NET.
r/functionalprogramming • u/lovelacedeconstruct • Feb 11 '25
I dont write java anymore but my experience with Java back in college was that it was very good introduction to OOP, everything was a class, syntax was very close to the diagrams, it felt like the concepts of OOP was just all there and you are forced to think using them, not saying whether thats a good thing or not or whether my assessment was correct but what do you think is the equivalent for FP ?
r/functionalprogramming • u/SrPeixinho • Jan 20 '25
r/functionalprogramming • u/davesnx • Feb 28 '24
- Declarative programming is better
- Everybody knows what's a monad, they already use them
- All languages are incorporating functional features
- I'm not annoying to my coworkers, I add value
- Learning FP is easier than learning imperative
- It's an interesting topic to discuss ALL THE TIME
- Yes, next quarter you are building a service with OCaml
- There are tons of companies using it already...
- It's based on mathematical terms, purity is just superior, and mutability is really really bad...
r/functionalprogramming • u/[deleted] • Jul 21 '22
I have been learning F# and in the books I am reading they mention writing purely functional code using maps, filters and Option types lead always to suboptimal code. Code written for performance always end up looking imperative. Is this always true? This is despite the fact that F# uses immutable data structures, which therefore can be stored in an optimal way to minimize expensive copying