3 ms·
It seems that you haven't had the "benefits" explained yet. Writing in a functional way allows you to express algorithms more easily than you could otherwise.
by JoelMcCracken 18y ago
It seems that you haven't had the "benefits" explained yet.
Writing in a functional way allows you to express algorithms more easily than you could otherwise. At any given point, while doing something functionally, you only need be concerned about the state of your inputs and your output(s). Letting go of state frees your mind from worrying about so many variables, and it allows you to think about the algorithms more easily. Of course, it may take a while to start to think about things functionally, but you'll have that any time you are learning something new.
Another benefit is it makes things easily concurrent, which is a large challenge for the game industry at large. Caveat -- make sure you know how your language/implementation deals with this, however. Erlang is much different than Common Lisp in this regard, for example (unless there is a specific CL language with threads that I don't know about).
BTW, basically every lisp you'd ever use has objects, or multimethods http://clojure.org/multimethods http://clojure.org/multimethods << basically the same thing, as far as it matters.
Thus, Lisp, ML, etc allow you to use FP whenever it is beneficial, and allow you to confine your state changes such that you won't have to worry about them nearly as much. Thus, many fewer bugs.
I cannot encourage you enough to continue to look into this. My only concern is that you will run into a lack of libraries, which clojure addresses, as everyone has already mentioned.