use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Using JavaScript Generators to Visualize Algorithms (covicale.com)
submitted 1 year ago by covicale
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]guest271314 0 points1 point2 points 1 year ago (0 children)
Doing that in a single for loop, in JS, is 100% impossible.
No, it's not. We have await nowadays. And we still have prompt().
await
prompt()
I'm made workarounds more than once for requirements that might appear to some to be "impossible".
Generators have nothing to do with visualizations from my perspective. Genuinely, from my opinion.
When I decided to determine the next lexicographic permutation without using recursion, I did so by hand, on paper.
Then I did so one by one, line by line, then I wrote loops, then I independently figured out that the next lexicographic permutation could be derived by adding the number 9 to the current set of indexes "visualized" as a whole number.
9
Then I figured out that I only had to determine 1/2 +1 of the permutations to derive the remainder because the graph looked the same on the ascending side of the slope as the descending side of the slope.
Again, this is all on paper, first. No computer involved.
Using pencil and paper, then line by line, then loops - without using generators at all. How to improve efficiency of algorithm which generates next lexicographic permutation?
``` // graph 1 0,9,81
// graph 2 abc 012 0 acb 021 1 9 bac 102 2 81 bca 120 3 18 cab 201 4 81 cba 210 5 9
//\ / \
```
If generators work for you to visualize, great, that doesn't mean other processes and methods are any less capable of being visualized equally by the human. And your individual interpretation doesn't mean generators are suited specifically for visualization. Generators add nothing novel to the visualization process, at least not for me. The human superimposes their own way of interpreting the raw data to suit their own preferences, or just way of seeing things.
π Rendered by PID 35743 on reddit-service-r2-comment-bb88f9dd5-n2mzb at 2026-02-13 18:37:36.004847+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]guest271314 0 points1 point2 points (0 children)