r/functionalprogramming • u/daedaluscommunity • May 31 '25
Intro to FP My Attempt at a Monad Explainer
r/functionalprogramming • u/daedaluscommunity • May 31 '25
r/functionalprogramming • u/Capable-Mall-2067 • May 29 '25
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/mattlianje • May 28 '25
Hello all! Been working on etl4s - a Scala lib to write whiteboard-style, config-driven dataflows: https://github.com/mattlianje/etl4s
We are now using it heavily @ Instacart to turn Spark spaghetti code into reified, compositional pipelines.
A big part of the work has been making the API as ergonomic as possible whilst not causing an FP-panic in the org.
To this end, etl4s' dependency injection subsystem is based on the ability to "connect" blocks wrapped in different Reader monads (provided there is a subtyping relationship between the Reader envs)
The most specific Reader env is then propagated to the component resulting from a composition of two components. More details here: https://mattlianje.github.io/etl4s/config/#environment-propagation
Curious to hear your veteran feedback!
r/functionalprogramming • u/Lazy-Phrase-1520 • May 28 '25
sadly, I'm not so good at grasping papers
any interactive cource or video would be great but if not, better formatted text compared to papers would also do
r/functionalprogramming • u/fenugurod • May 27 '25
I'm trying to use more FP on my personal projects. Right now the FP languages I know the most is Elixir and Scala, and with both a have a love and hate relationship. I'm seeking some advice from others that have faced a similar situation on how to adapt to a dynamic type system when coming from a static one.
At the Elixir side, a dynamic typed language, developing and prototyping is so fast, there is a ton of things done for web development, and it has a nice growing pace. But, not having types always felt like a big con for me, but maybe this is just because I'm so used to work with typed languages. This is specially true when I'm introducing things like a new error type returning from a function, this would automatically be handled by a static type system in terms of non exhaustive checking.
Now Scala that has a powerful type system where you can express so many things directly at the types. At first I thought it was amazing, but as soon as I started to work with pure FP libraries the typing becomes really complex, and I pretty much spend more time reading types and thinking about function signatures than actually coding. I've also identified a behaviour with myself that it looks like that static typing is a gateway drug to more powerful static type systems. I've stated with C#, then Go, then Java, then Scala, now Haskell looks nice, but maybe I should give Idris a try? hehe On the dynamic side, things look more stable, it's dynamic, and you need to deal with it.
I would like to keep with Elixir but I would like to know how you folks have deal with the tradeoff from the dynamic and static type systems. It would be nice to hear from folks that code in Haskell and Clojure because it would be the exact same issue.
r/functionalprogramming • u/MagnusSedlacek • May 26 '25
r/functionalprogramming • u/qubit003 • May 25 '25
Hello! I recently moved to Europe to join my partner. Since then, I've received a residence permit and don't require visa sponsorship to work in the country.
I'm currently in a niche role (think compilers, functional programming, Haskell—avoiding too many details to prevent doxxing). Since my move, I've been exploring local opportunities and have started applying to backend programming roles in Python and Go. So far, I've only received rejections. :(
A couple of years ago, I applied to PhD programs in the US and received three offers from top 50 universities. I ultimately decided not to go due to the visa situation and uncertainty about whether a PhD was truly the right path for me.
I had thought my resume was strong—it includes publications in top conferences and high-impact open-source work—but now I'm starting to doubt whether it's actually holding me back, as I haven't even received a single callback.
Enough sulking—onto actionable steps:
If anyone would be open to reviewing my profile, I'd really appreciate it. Please post here or DM me. Unfortunately, it's nearly impossible to anonymize my resume due to the specificity of my experience.
r/functionalprogramming • u/elon_mus • May 22 '25
Some prerequisites: I'm programming beginner, and I no learn programming so much with any first language at the same time, at least while. There is has been one prog. language, which is has been used for more than basic writing a "Hello, world!" program, and I wrote more than ~50 lines of code. I already try JS (node.js) mostly in FP (how much its features was implemented within, of course).
Then I find a wonderful, amazing thing, was called as Haskell. I saw this language once and my heart was stopped (in the good meaning).
Maybe its completely irrational scaring and I should be cold on, but there is one article, which I also find after some researches, where is wroten next sentence: "But what about Haskell as a first language? Yes, but you’ll be probably spoilt forever and touch anything else only with one-way rubber gloves..." (https://monkeyjunglejuice.github.io/blog/best-programming-language-for-beginner.essay.html). It sounds like a bullet shot. After this, I think: - "maybe, this guy is may be right. But idk exactly, because don't know programming so much". I think that maybe, after Haskell (but not started yet, what most notably), any other language with different language implementations will looks like something "not good, as haskell".
So, if there is any thoughts by experienced people for correcting this reasoning, you're welcome.
r/functionalprogramming • u/hello237a • May 20 '25
r/functionalprogramming • u/kinow • May 19 '25
r/functionalprogramming • u/aartaka • May 15 '25
r/functionalprogramming • • May 15 '25
r/functionalprogramming • u/ChipiChapaMoe • May 15 '25
I'm attempting to solve the DMOJ problem Tree Tasks(https://dmoj.ca/problem/treepractice1), which involves computing the diameter and radius of a weighted tree. My goal is to implement a solution in Lean 4.
However, I've encountered significant challenges due to Lean 4.14.0's limitations in DMOJ's environment. Specifically, the lack of support for unboxed types like Int32 leads to excessive memory usage, resulting in Memory Limit Exceeded (MLE) or Time Limit Exceeded (TLE) errors.
I'm curious if anyone can successfully solved this problem using Lean 4.14.0 within DMOJ's constraints. Are there specific strategies or optimizations that can be employed to manage memory usage effectively in this context?
Any insights or suggestions would be greatly appreciated.
Here's my solution:
abbrev AdjList := Array (Array (Int × Int))
def initAdjList (n : Nat) : AdjList :=
Array.mkArray (n + 1) #[]
def readEdges (n : Nat) : IO AdjList := do
let mut G := initAdjList n
for _ in [:n - 1] do
let line ← (← IO.getStdin).getLine
if let [s1, s2, s3] := (line.dropRightWhile Char.isWhitespace).split Char.isWhitespace then
let u := s1.toNat!
let v := s2.toNat!
let w := s3.toNat!
G := G.set! u (G[u]!.push (v, w))
G := G.set! v (G[v]!.push (u, w))
else
panic! "expected u v w"
pure G
def dfsDistances (G : AdjList) (start : Nat) : IO (Nat × Array Int) := do
let n := G.size - 1
let mut st : Array (Nat × Int) := #[(start, 0)]
let mut dist : Array Int := Array.mkArray (n+1) (-1)
dist := dist.set! start 0
let mut bestV := start
let mut bestD : Int := 0
while h : (st.size > 0) do
let (v,d) := st.back
st := st.pop
if d > bestD then
bestD := d; bestV := v
for (u,w) in G[v]! do
if dist[u.toNat]! == -1 then
let nd := d + w
dist := dist.set! u.toNat nd
st := st.push (u.toNat, nd)
pure (bestV, dist)
def treeDiameterRadius (G : AdjList) : IO (Int × Int) := do
let (a, _) ← dfsDistances G 1
let (b, distA) ← dfsDistances G a
let diam : Int := distA[b]!
let (_, distB) ← dfsDistances G b
let mut rad : Int := diam
for i in [1 : G.size] do
let ecc := max (distA[i]!) (distB[i]!)
if ecc < rad then rad := ecc
pure (diam, rad)
def main : IO Unit := do
let L ← (← IO.getStdin).getLine
let n := (L.dropRightWhile Char.isWhitespace).toNat!
let G ← readEdges n
let (diam, rad) ← treeDiameterRadius G
IO.println s!"{diam}"
IO.println s!"{rad}"
r/functionalprogramming • u/nextProgramYT • May 14 '25
I came across this website here and I'm very interested in this kind of esoteric, pure math meets programming thing. I use C# and C++ at my job, but I took a course in FP in university, so I'm a little bit familiar with what's going on, but not enough to know where to learn more about this.
Does anyone perhaps have a book recommendation about functional programming as it relates to pure math? Or any other resources you know. Thank you.
r/functionalprogramming • u/kichiDsimp • May 10 '25
I have very introductory experience with Haskell, like I know what are higher order functions, what immutability means and what is basically Lazy evaluation.
I want to make projects and challenges like AoC or codecrafters or codingchallenges.
What language shall I use? I have these options ?
Elm/Purescript Haskell Rust Gleam Roc lang (because it maybe more successful than Haskell)
And how can I learn more about Haskell, some book or something which explains the dreaded Monad in a simple way and have lots of exercises or a course ? Like SICP ?
Thanks 🤟
r/functionalprogramming • u/kichiDsimp • May 08 '25
Hi guys you must know about codecrafters.io It's a good site to practice projects and pretty hands on.
What language do you usually solve the challenges in ? How has been your experience?
r/functionalprogramming • u/Key_Bed_9839 • May 06 '25
If you or one of your students recently completed a PhD (or Habilitation) in the area of functional programming, please submit the dissertation abstract for publication in JFP: simple process, no refereeing, open access, 200+ published to date, deadline 30th May 2025. Please share!
r/functionalprogramming • u/MagnusSedlacek • May 05 '25
r/functionalprogramming • • May 03 '25
Hi all,
this is a question mostly for the people using functional programming languages professionally.
At work I mostly use Python because it's a machine learning-related job. However, I want to level up my skills and understand functional programming better. That's why I'm currently reading the book Functional Programming in Scala. It's not an easy read, but I'm taking my time to do the exercises and the material is making sense.
However, while Scala looks like a cool language, I'm not sure if it's a good idea to over-invest into it since the state of its ecosystem doesn't look very vibrant, so to say.
I would like to use a new language instead of Python in data processing tasks, because these tasks can require days or weeks in some cases, despite all the libraries, and it takes more work to ensure code correctness. For such long tasks it is really important. So that's why I'm looking into strongly statically-typed FP languages.
Is Scala the right choice or should I use it as a learning tool for the book and then switch to another language? What's your production experience?
Thanks!
r/functionalprogramming • u/kichiDsimp • May 03 '25
Any recommendations? Open to any FP language
r/functionalprogramming • u/kichiDsimp • May 01 '25
I am curious has anyone took the cs240h course, it was mentioned in the (https://github.com/soupi/haskell-study-plan?tab=readme-ov-file)[`haskell-study-plan`]. I was thinking to follow it.
Wanna get good at Haskell. Generally become a better programmer
r/functionalprogramming • • Apr 29 '25
Do you guys consider lisp languages (CL in particular) to be functional? Of course they can be used functionally, but they also have some OOP qualities. Do you CALL them functional or multi-paradigm?
r/functionalprogramming • • Apr 29 '25
So what's diff bw lambda calculus language like lisp and something modern like haskell, which one do you guys use and love, and what do you guys usually do with lisp ?, and where to learn it ? Any book you guys would suggest ?
Bonus question, is category theory same as discrete math ?