46
submitted 1 year ago by coja@lemmy.ml to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] linuxduck@nerdly.dev 1 points 1 year ago

I loved learning lambda calculus (though for me it was super hard)

[-] Gork@lemm.ee 0 points 1 year ago

I never really understood the point of Lambda calculus. Why have an anonymous function? I thought it was good practice to meticulously segment code into functions and subroutines and call them as needed, rather than have some psuedo-function embedded somewhere.

[-] rabirabirara@programming.dev 1 points 1 year ago

I think you're confusing lambdas with lambda calculus. Lambda calculus is more than just anonymous functions.

To put it extremely simply, let's just say functional programming (the implementation of lambda calculus) is code with functions as data and without shared mutable state (or side effects).

The first one increases expressiveness tremendously, the second one increases safety and optimization. Of course, you don't need to write anonymous functions in a functional language if you don't want to.

As for why those "pseudo-functions" are useful, you're probably thinking of closures, which capture state from the context they are defined in. That is pretty useful. But it's not the whole reason lambda calculus exists.

this post was submitted on 19 Jul 2023
46 points (96.0% liked)

Programmer Humor

32730 readers
509 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS