News for hackers. Stuff that matters.
Re:Why Racket? Why Lisp? (2014) by revskill on Wednesday September 14, 2022 @01:39PM (#32840571)
Enough praise for FP. Now let's go back to real world.

Please help tell me what's the best way to replicate what's good in OOP, like how to use FP to solve expression problem ?

Re:Why Racket? Why Lisp? (2014) by hither_shores on Wednesday September 14, 2022 @02:59PM (#32841680)
> like how to use FP to solve expression problem

Some common approaches:

- Tagless final style: https://okmij.org/ftp/tagless-final/

- Datatype-generic programming: https://markkarpov.com/tutorial/generics.html

- Polymorphic records and variants: https://www.cl.cam.ac.uk/teaching/1415/L28/rows.pdf

Re:Why Racket? Why Lisp? (2014) by Twisol on Wednesday September 14, 2022 @03:49PM (#32842429)
I'm a very big fan of the "object algebras" approach [0], which is essentially tagless final minus the automatic instance resolution you get with typeclasses. It works great even in fairly restrictive type systems like Java's.

[0]: https://www.cs.utexas.edu/~wcook/Drafts/2012/ecoop2012.pdf

Re:Why Racket? Why Lisp? (2014) by panzerklein on Wednesday September 14, 2022 @01:49PM (#32840700)
Expression problem exists in both OOP and FP[1]

[1] https://wiki.c2.com/?ExpressionProblem

Re:Why Racket? Why Lisp? (2014) by BeetleB on Wednesday September 14, 2022 @04:10PM (#32842693)
I can understand the pushback against FP, but it doesn't follow that if FP is a poor choice, then the only realistic alternative is OOP.

I do a lot of Python stuff - much of it is not functional programming. And very little of it is OOP.

The programming world doesn't consist of just these.

Re:Why Racket? Why Lisp? (2014) by iterati on Thursday September 15, 2022 @10:10AM (#32852277)
These are the dumbest type of comments. People are doing real world work in FP, but because it's not the work you do (or you're not comfortable doing the work you do in FP) you're deluded to thinking that no real work gets done in it.
Re:Why Racket? Why Lisp? (2014) by deltasevennine on Thursday September 15, 2022 @01:48PM (#32855808)
He's a Fullstack JS developer which is even dumber because he uses React which is basically the defacto JS front end framework.

React is trending heavily away from OOP, it's creators heavily buy into FP, and most of the patterns in react are inspired heavily by FP. Functional components are now the way to go.

ReasonML (a pure FP language) is react as intended and is the northstar of React.

To learn more here is a video from Jordan Walke creator of React (and ReasonML): https://www.youtube.com/watch?v=5fG_lyNuEAw

I recommend parent commenter to learn more about the very tools he himself works with before disparaging FP and himself.

Re:Why Racket? Why Lisp? (2014) by deltasevennine on Wednesday September 14, 2022 @02:22PM (#32841128)
OOP is a mass delusion not dissimilar to religion.