Can anyone recommend a good resource on learning the basics of functional #programming?
It's nice to have a #Perl resource; but, these resources seem to assume an existing background in FP.
I don't have a background in Lambda Calculus. But, I'm really interested in FP as a way to write code that can be quickly and easily debugged. Any suggestions?
> Can anyone recommend a good resource on learning the basics of functional #programming?
Here are couple of #raku resources that I think are pretty good. I also write most of my Raku code in functional-ish style, and would be happy to answer questions I can.
@codesections Dude! Thanks for the resource.
This is a helpful start. I didn't know sigil-less variables were a thing. For obvious reasons, I thought \var was reference passing notation even in Raku.
I'm going to read this over carefully in a few hours. This is cool.
@profoundlynerdy I've got a good link from a Python perspective: https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming
@profoundlynerdy personally I think from a learning perspective the best way to go is to pick up a language that is designed specifically for functional programming.
after you've spent some time in that, it becomes a lot easier to understand how to apply functional techniques in languages that don't necessarily lean that way out of the box.
(that said, I understand this might not be a realistic suggestion for your present situation)
I've thought about picking up some Haskell, mostly out of curiosity. It's functional. But, that also seems like the long way around.
I really want to apply this to my current Perl code. I do in fact write greenfield Perl scripts all the time.
But, also I occasionally inherit some... less than optimal Perl scripts.It seems to me that if I refactor them with a functional bend I'll send less time debugging during the refactor process. Is that accurate, or have I drank some KoolAid?
@profoundlynerdy yeah, it's fair to say that learning a whole new language is too much; 100% agree with that. but on the other hand, I personally don't know how else to accomplish what you're asking. =)
I don't know anything about perl, but applying functional techniques to greenfield code is a ton easier than adapting legacy code to make it more functional.
@profoundlynerdy what you want to end up with is a kind of "functional core, imperative shell" situation where as much logic as possible is done in pure functions, and the "outer bits" are the ones responsible for all IO, data structure mutation, etc. the shell should be as small as possible because those operations are the ones that are hardest to debug.
but this can require turning a codebase "inside out" which can be hugely disruptive for legacy code.
@profoundlynerdy Although not related to Raku or Perl, here are some resources I find very good:
General functional #programming terms:
I would spend some time reading Lessons Learned in Software Testing. Before I ever touched Little Lisper, Learn You a Haskell, etc.,
It’s the part on drinking port in Lessons Learned in Software Testing that I would pay most attention to. You’ve got to learn to read these non-textbooks right.
I also think that setting up an ssh server that just contains text files that your friends cooperatively build from the Little Schemer would not be a bad idea.
@WildKeccak Thanks for the tip!
I bought a copy of *Lessons Learned in Software Testing* at your recommendation. I'll have a look.
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!