xwero—can you explain this statement:
@mironcho : i assumed the function argument all have a default otherwise it would be an (almost?) impossible challenge.
Even my one liner can take any number of parameters, in any order, without default values, or any predefinition of any kind.
The only exception to this is if you want to have a variable name available with the data. For instance, if you pass ‘Johnny Appleseed’ to a non-determinate function such as this, there is no way for this function to know about any kind of meta data associations linked to this data. That would be perfect for simple math problems or string concatenations (like the Functional Programing thread the other day). On the other hand, if you send in $address = ‘East Blvd’ the function now can extrapolate that ‘East Blvd’ and $address have some intrinsic relationship. So with all this in mind, it should be reasonable to expect that the relationship between a variable name and the data it contains must be established in advance.
If you put this in the function call you make this a mandatory construct. Remove it from the function declaration and you have the flexibility you need. There is just one little dilemma that always creeps into the equation that makes the solution a kludge. But it still works…and it is still in one (1) line or 11 if you want the whole shebang.
Let me know when you’re ready for it.
Randy