in reply to Re^3: Only joining elements of an array that are defined
in thread Only joining elements of an array that are defined

<shrug/>Whatever works for you. I find that always using the block form of grep and map is a lot clearer for the compiler as well as human reader, and can prevent mistakes for more complicated expressions, at the cost of one extra character. So unless you're golfing it's probably better to stick with that.


All dogma is stupid.

Replies are listed 'Best First'.
Re^5: Only joining elements of an array that are defined
by Fletch (Bishop) on Feb 14, 2006 at 14:19 UTC

    The BLOCK form however does incur a bit more overhead since it has to do all the steps incurred entering and exiting a block. If it's done once, you're probably not going to notice it; if it's a statement you're executing each line for your 1G data file it may add up. Granted it's relatively small and may have been optimized in recent versions, but be aware of the overhead if you're looking for somewhere to shave a few microseconds off after you benchmark (of course always benchmark :).

Re^5: Only joining elements of an array that are defined
by blazar (Canon) on Feb 15, 2006 at 09:55 UTC

    I disagree. If EXPR is simple enough, as in this case, then at least for me it is much easier to read. I'm just used to it. Of course should it grow complex enough, then it would soon become a pita, thus I would prefer a BLOCK instead. I don't have the slightest idea about the compiler - and I don't care much.