Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsort: add page #2278

Merged
merged 3 commits into from
Sep 6, 2018
Merged

tsort: add page #2278

merged 3 commits into from
Sep 6, 2018

Conversation

MasterOdin
Copy link
Collaborator

@MasterOdin MasterOdin commented Aug 30, 2018

A command from the list in #2213

  • The page (if new), does not already exist in the repo.

  • The page (if new), has been added to the correct platform folder:
    common/ if it's common to all platforms, linux/ if it's Linux-specific, and so on.

  • The page has 8 or fewer examples.

  • The PR is appropriately titled:
    <command name>: add page for new pages, or <command name>: <description of changes> for pages being edited.

  • The page follows the contributing guidelines.

@tldr-bot
Copy link

The build for this PR has failed with the following error(s):

pages/common/tsort.md:5: TLDR104 Example descriptions should prefer infinitive tense (e.g. write) over present (e.g. writes) or gerund (e.g. writing)

Please fix the error(s) and push again.

@owenvoke owenvoke added the new command Issues requesting creation of a new page. label Aug 30, 2018

> Perform a topological sort.

- Perform a topological sort consistent with a partial sort per line of input broken up into elements separated by blanks:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erm I'm confused! What does this do? That's a lot of words jumbled up in that sentence.

Perhaps we could add some additional clarity in a second line of the command description too - maybe something like this?:

> In other words ......

Copy link
Collaborator Author

@MasterOdin MasterOdin Aug 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was my worry when I wrote this.

Essentially, it takes a file where each line is some list of "dependencies":

a b c
d
e f
b c d e

which can be read as:

  • a is before b which is before c
  • e is before f
  • b is before c which is before d which is before e

and produces a topological sort of it:

a
b
c
d
e
f

So the gist of that sentence is:

  • Produces a topological sort of a file which has some number of lines
  • Each line of the file gives a partial ordering of elements for the sort
  • Each element is separated by a space

I'm not sure how wordy of an explanation you guys allow to expand on that singular sentence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. What kind of use-cases are there for this kind of thing? Perhaps we could use one to relate the idea better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case would be to see the ordering of dependencies within a directed acyclic graph (a common example is function calls within a program).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can condense it to - Perform a topological sort consistent with a partial sort per line of input separated by blanks:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok! Perhaps we could add a 2nd description line saying A common use is on function calls in a program.?

Copy link
Member

@sbrl sbrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @MasterOdin 😺

@sbrl sbrl merged commit 73f0750 into tldr-pages:master Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new command Issues requesting creation of a new page.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants