I am making a function that will evaluate several other functions, using the same inputs, in my program and give me the results. I am using Print
to do this (see Picture.) The problem is that one of them is printing Null
along with the answer. Is there a way to get this Null
to not print out? Maybe another way to write this function of functions?
Poly = {w1, w2, w3, w4, d} \[Function] Module[{},
Print[FFFF[w1, w2, w3, w4, d]];
Print[FFC2[w1, w2, w3, w4, d]]];
Here is the function that is giving the null...
FFC2 = {w1, w2, w3, w4, d} \[Function]
Module[{weights, allsol, dup, sol, rsol},
weights = {w1, w2, w3, w4};
allsol = DeleteCases[DeleteDuplicates[Flatten[Table[
If[
l != i != j !=
k &&
{d/weights[[l]],
d/weights[[i]]} \[Element]
Integers &&
Chain2[weights[[j]], weights[[k]], d] != {},
Flatten[{d/weights[[l]], d/weights[[i]],
Take[Chain2[weights[[j]], weights[[k]], d], 2],
weights[[l]],
weights[[i]],
Drop[Chain2[weights[[j]], weights[[k]], d], 2]}, 1],
{}] , {l, 4}, {i, 4}, {j, 4}, {k, 4}],
3]], {}];
dup = DeleteCases[
Flatten[Table[
If[i < j &&
Sort[Take[Drop[allsol[[i]], 4], 2]] ==
Sort[Take[Drop[allsol[[j]], 4], 2]], allsol[[i]], {}], {i,
Length[allsol]}, {j, Length[allsol]}], 1], {}];
sol = Complement[allsol, dup];
If[sol == {{}} \[Or] sol == {}, "No Possible FFC2",
For[k = 1, k < Length[sol] + 1, k++,
Print[StringTemplate[
"FFC2: w^``+x^``+y^``z+z^`` with weights: {``,``,``,``}"][
Sequence @@ Take[sol, {k}][[1]]]]]]];
And it prints out:
The reason Null
is printing is because the answer that is given by the function in the second picture is a result of Print
, but I don't know how to have the answer print without it.
Null
is the return value of the functionFFC2
. It is probably the value of the expression with headFor
... Note thatPrint
is not the right way to return the result of a function. $\endgroup$