Bunny Café

@foldr why fold to the right and not to the left tho

@neets I... I've been foldr for so long that I don't even remember. I think I was learning Haskell and foldr sounded cool

@foldr that's fair. I think I might've used rplacd (from common lisp) as username on some site even though I've barely written any common lisp

@neets What does that function do? I did some Scheme back in college and that's pretty much it. Regarding the names, I believe every FP nerd has this honeymoon period where FP is fantastic until you realize it sucks on its own ways. If you happen to be looking for an username during that period...

@foldr RPLACD replaces the cdr of a mutable cons cell with another value, the corresponding function for the car is called RPLACA
I still prefer functional programming tbh, I write code in mostly functional style for my day job and when I have to write something on my own I'll do it in OCaml or F#.

@neets It's pretty cool when you can do it. Tho I have to admit I prefer a well designed OO system over a functional one. Most OOP code sucks ass, so I see the appeal of FP for most people. I personally really enjoy seeing the objects interact with each other, like a well oiled machine. FP is more like poetry.

@foldr I think FP and OO can complement each other very well, for example both OCaml and F# have objects for when it makes sense to use them

@neets That is very true. If you read my Python code, it is full of comprehensions and other functional idioms all nicely packed in well thought (or so I tell myself) OO interfaces. That was one of the reasons why I ended up disliking Haskell. I can't do OOP when I want/need. I kinda want to use OCaml for some large project, but I know my boss is going to hate the idea...
replies
1
announces
0
likes
0

@foldr

I can’t do OOP when I want/need.

Yeah i hear you. I made a game in F# for a jam last week and it’s a horrible mess of mutable variables and arrays and dictionaries because that was much faster to iterate on.

And OCaml is a hard sell, it’s a very niche language and the library ecosystem is not very big so you’ll probably end up having to write some stuff on your own, and depending on the conditions of the job it’s gonna be hard to find somebody else to maintain all that code. I just make do with typescript at my day job, honestly it’s not too bad. Sometimes I even get to write fun monstrosities like type-level parsers for url paths.

@neets For gamedev I think OOP is just a better tool than FP. For my OCaml dreams, I'm in academia, so maybe I can find a better usage for it. I was thinking something related to program analysis, where FP is king.

@foldr yeah a lot of FP advice isn't really suited for gamedev for a lot of reasons, but still if I'm using F# I can both do everything you can do in C# and also use sum types and pattern matching which are always a big win, imo.
And if you're in academia I guess OCaml is not that bad of a choice for whatever it is you're doing?

@neets Is not a bad choice if you are somewhat related to programming languages research. Outside that the de facto language is different. Empirical people likes Python. More mathematical minded folks don't even code.