I attempted to write part of my code after what I found at ( get while loop output into a list ) which is the post "get while loop into a list (duplicate)", which there shows an example
n = 1;
While[n < 10,
Print[RandomSample[Join[Table["a", {2}], Table["b", {2}]], 2]]; n++]
This is not my code, but it gives an idea of why I structured my code this way. What you'll see below is a while loop in which I used reap and sow in hopes of making a list, which is all I need. I was successful in getting the info I needed but strangely it seems before the output starts I get a vertically lined version of the actual output that follows in the list form I specified. Here's the part of my code making it happen and what happens:
Flatten[Drop[Reap[d = 0; While[d < (2^n), Print[Sow[Extract[Drop[First[RealDigits[Mod[f (2^d), 1] + 1]], 1], (h - (d +4))]]]; d++]], 1]]
Which gives me (for my not shown variable values):
4
2
6
5
9
7
1
0
Out[(some number)]= {4, 2, 6, 5, 9, 7, 1, 0}
I've tried everything short of throwing the kitchen sink at it to just show me the list-form output I designed but it keeps preceding the output with that stupid column and as you can imagine, as I try to evaluate large data it keeps extending to hundreds of pages. Please help me shut this thing up. The desired output should just be the list at the end, {4, 2, 6, 5, 9, 7, 1, 0}. The variable values shouldn't matter since the form is the problem.
Table
,Map
,Fold
,Nest
and friends; if your are using loops in Mathematica you are doing something wrong. Check out Alternatives to procedural loops and iterating over lists in Mathematica $\endgroup$f
andh
we can't even run your Franken code. $\endgroup$Print
$\endgroup$Print[]
ing his expression, and then sowing the output. It's rather convoluted. $\endgroup$Print[]
literally just prints the expression to output. But I don't see why you are usingSow
andReap
in the first place. What's wrong with just aTable[]
? $\endgroup$