2
$\begingroup$

I cannot figure out why my rowNameValue[] is only listing the first part of a column or vector. Below is the code.

objectName = Function[Null, SymbolName[Unevaluated[#]], {HoldFirst}];
ClearAll[m, b]
m = {{1, 0, -5}, {0, 1, 1}, {0, 0, 0}};
MatrixQ[m]
b = {1, 4, 0};
VectorQ[b]
rowNameValue[symbol_, name_ : Null] := Block[{id, fn},
   id = If[Head[name] === String, name, objectName[symbol], 
     objectName[symbol]];
   id = If[MatrixQ[symbol] || VectorQ[symbol], Style[id, Bold], id, 
     id];
   fn = If[MatrixQ[symbol] || VectorQ[symbol], MatrixForm, 
     TraditionalForm, StandardForm];
   {Row[{id, " \[Rule] "}, " "], Apply[fn, symbol]}
   ];
dataIn[m_, b_] = Block[{}, Grid[{
    rowNameValue[m, "m"],
    rowNameValue[b, "b"]
    }]]
dataIn[m, b]
$\endgroup$

1 Answer 1

2
$\begingroup$

Replace Apply[fn, symbol] with fn @ symbol:

dataIn[m, b]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ thank you it worked $\endgroup$ Commented Jun 8, 2020 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.