When evaluating functions, including those described in this post, how do Mathematica users handle values returned from a function that are unevaluated? For example (based on 1):
i[{a_, Longest[b__], c__}] := {"a" -> a, "b" -> {b}, "c" -> {c}} /; Length[{a, b, c}] > 3;
test = {{1, 2}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}};
j=i/@test
(* returns {i[{1, 2}], {"a" -> 1, "b" -> {2, 3, 4}, "c" -> {5}}, {"a" -> 1, "b" -> {2, 3, 4}, "c" -> {5}}} *)
So the first element of j is i[{1, 2}] - this is neither the original input {1,2} nor in the form of the rest of the output. Two questions:
a) While it is likely to be application specific, what approaches do others use to handle unevaluated values that are returned?
b) Is there a generic way to detect unevaluated 'returns' for additional parsing ?
My current thought is to use Identity and ReplaceAll to eliminate the 'unwanted' function i:
k=j/.i->Identity
(* returns {{1, 2}, {"a" -> 1, "b" -> {2, 3, 4}, "c" -> {5}}, {"a" -> 1, "b" -> {2, 3, 4}, "c" -> {5}}} *)
but this approach requires the name of the function (here i) that was evaluated. Are there any other tricks or approaches to handle this? Am I overlooking benefits to retaining the unevaluated output ?