I have a list of words
list={"ingenuous", "forgotten", "tree", "supercomput", "hundred"}
How can I put the letters of each word in an element of a table such as here:
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI have a list of words
list={"ingenuous", "forgotten", "tree", "supercomput", "hundred"}
How can I put the letters of each word in an element of a table such as here:
list = {"ingenious", "forgotten", "tree", "supercomput", "hundred"};
list /. word_String :> Join[{word}, Characters@word] // Grid[#, Dividers -> All] &
/.
, :>
,@
, //
, #&
and friends this style of writing mathematica code is imho the most readable of all.
$\endgroup$
Prepend[Characters[word], word]
myself.
$\endgroup$
Jul 8, 2016 at 13:11
{word} ~Join~ Characters@word
. Sometimes (not necessarily in this case) infix notation helps to further convey what the particular line of code does (precedence becomes somewhat difficult to assess though)
$\endgroup$
As the promp of Sascha's answer,I simplify this code be
list={"ingenuous","forgotten","tree","supercomput","hundred"};
Grid[Join[List/@list,Characters/@list,2],Frame->All,Spacings->{2.6,0.5}]
Characters[]
? $\endgroup$TableForm[Characters /@ list, TableHeadings -> {list, None}]
. $\endgroup$TableForm
cannot set gridding line. :) $\endgroup$TableForm
is under-appreciated, that is why I provided a line with it. $\endgroup$