On Fri, 9 Jul 2004 05:03:10 +0900, Sean O'Dell <sean / celsoft.com> wrote:
> On Thursday 08 July 2004 11:52, Sean Russell wrote:
> >
> > Incidentally, from the comp.lang.functional FAQ:
> >
> > "Functional programming is a style of programming that emphasizes the
> > evaluation of expressions, rather than execution of commands. The
> > expressions in these language are formed by using functions to combine
> > basic values. A functional language is a language that supports and
> > encourages programming in a functional style."
> >
> > "Definition: A language that does not allow any destructive
> > operation---one which overwrites data---such as the assignment
> > operation. Purely functional languages are free of side effects, i.e.,
> > invoking a function has no effect other than computing the value
> > returned by the function."
> 
> May I add: there is "functional programming style" and "functional programming
> language."  Ruby is not really a functional programming language, but you can
> program in a functional style with it.  If you don't maintain state, and
> don't call methods that use stateful data, you are programming in a
> functional style.  Tail recursion optimization and currying are, I believe,
> just implementation features, not really defining properties, of functional
> programming.
> 
>         Sean O'Dell


i find this thread very iteresting, and conducted a similar
conversation in my head many moons ago.

i agree most with the "other" sean as quoted here.  (p.s.
international brotherhood of seans, unite!)

ruby may not be described as a traditional "functional programming
_language_" if only because functions are not the
primary/primitive/first-order structure (sorry, the definitive word
for this has brainfarted on me at the moment, please correct); in
ruby, objects are.

however, the spectrum and natural opposite of "functional programming
_style_" is not object-orientation but _procedural_ programming.  i
find procedural programming a bane on humanity (those with computers
anyway) and an artifact of von neumann architecture.

functional style and object-orientation are orthogonal to each other.

i believe a very important step in improving the defacto style or
"pattern language" in which ruby (and all) software is written, would
be to adopt a functional style and eschew procedural programming. 
(but pure OO rocks the house!)  for me, a more ideal style that
unifies these into object-functional is the actor or flow-based
programming (FBP) style.  (sometimes simply "data flow" programming.)
http://www.jpaulmorrison.com/fbp/index.shtml
http://cliki.tunes.org/Actor
http://c2.com/cgi/wiki?ActorsAndFlowBasedProgrammingDiscussion


also, assignment in ruby is much improved over von neumann C-style
assignment.  in ruby assignment is merely the naming of objects for
convenient reference (like pointers). see "Assignment" @
http://www.rubycentral.com/book/tut_expressions.html  correct me if
i'm wrong, but isn't this essentially what functional programming
languages call "macros"?

-z