On Nov 15, 3:04 pm, Robert Klemme <shortcut... / googlemail.com> wrote:
>
> Here is another approach that completely gets rid of temporaries without
> needing #as:
>
> all_files =
>    add_suffixes(source_files +
>                add_prefixes(
>                  stems.map { |stem| "#{stem}.#{guess_extension stem}" }
> )).map { |basename|
>    File.join dir, basename
>
> }
>
> If anything this seems more functional to me, since you have to read
> inside out. :-)  SCNR

Whether the function call syntax is prefix, infix, or postfix is
independent of whether it's functional style or not.  One reason I
like ruby is because I can be functional with postfix syntax.  I
prefer reading block chains and method chains from beginning to end,
as opposed to prefix-syntax function calls from inside to outside.
Object#as allows me to keep the chain going when I am forced to use a
prefix syntax like File.basename().

I would also add that I make temporaries all the time.  I do however
avoid re-assigning to the same temporary and, in most circumstances,
modifying the contents of a temporary (to be ditched when practical
concerns for efficiency are relevant).

-FC