I have something to admit: I've never done any serious programming in a
functional language. Yes, yes, I've done some small school assignments in
Scheme (a
dialect of Lisp), even helping out my friend from another university with his
Scheme assignment but nothing real . Does this
make me a worse programmer? Probably not, I imagine most developers haven't
done anything real with functional programming. Although that's probably not
what you'd expect from reading Hacker News,
where you don't know programming if you haven't tried Clojure or Haskell .
My position is much more pragmatic: I'm interested in tools and techniques that
help me solve problems faster, cleaner and with less headache. Ideas and
concepts from functional programming languages are supposed to help with at
least some of that -- and they do; they're just not a panacea for all your
programming woes. Like most things a solid grasp of the fundamentals goes a
long way. So the topic of this post is about something pretty fundamental: a
subroutine. In particular, two important kinds of subroutines:
procedures and pure functions.
Read more…