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

Concept: Pipelines and Command Lists #714

Merged
merged 8 commits into from
Dec 8, 2024
Merged

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Nov 25, 2024

No description provided.

@glennj glennj marked this pull request as draft November 25, 2024 23:32
@glennj glennj requested a review from a team November 25, 2024 23:37
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
```

The pipe symbol (`|`) connects the output of one command to the input of another.
`cut` reads the output of `cat`, and `sort` reads the output of `cut`.
Copy link
Member

Choose a reason for hiding this comment

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

Do you want to take a step back and mention how many commands read from STDIN (and/or a file) and write to STDOUT? Introduce STDIN/STDOUT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I'll do a "sneak preview" of I/O, with a promise of more to come in a later concept.

concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

Even though draft, still looks good to me.

concepts/pipelines/.meta/config.json Outdated Show resolved Hide resolved
@glennj glennj marked this pull request as ready for review December 2, 2024 13:13
@glennj glennj force-pushed the concept-pipelines branch from 806ff1d to 253f794 Compare December 2, 2024 13:14
@glennj
Copy link
Contributor Author

glennj commented Dec 2, 2024

@IsaacG can I get your opinion on the I/O blurb please?

concepts/pipelines/about.md Outdated Show resolved Hide resolved
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

Some suggested changes, but still approved.

concepts/pipelines/about.md Outdated Show resolved Hide resolved
concepts/pipelines/about.md Outdated Show resolved Hide resolved
concepts/pipelines/about.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
concepts/pipelines/introduction.md Outdated Show resolved Hide resolved
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

Still approved.

There is also one place where we have a sentence per line broken at a comma, I think that is kind of a nice thing to do for longer sentences anyway. But it is inconsistent, as there is one that is done this way but another that could benefit the same way.

Not a big deal, just a note here.

concepts/pipelines/about.md Outdated Show resolved Hide resolved
@glennj glennj force-pushed the concept-pipelines branch from 16eb3a0 to f25361a Compare December 5, 2024 13:47
concepts/pipelines/about.md Outdated Show resolved Hide resolved
concepts/pipelines/about.md Outdated Show resolved Hide resolved
concepts/pipelines/about.md Outdated Show resolved Hide resolved
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

A couple of changes proposed, and one thing to consider.

@glennj glennj merged commit 001340e into exercism:main Dec 8, 2024
2 checks passed
@IsaacG
Copy link
Member

IsaacG commented Dec 8, 2024

@IsaacG can I get your opinion on the I/O blurb please?

Sorry for missing that. It's been a hectic two weeks. The blurb looks good! Do you still want nitpick improvement suggestions?

@glennj
Copy link
Contributor Author

glennj commented Dec 8, 2024

Do you still want nitpick improvement suggestions?

Always!

@glennj glennj deleted the concept-pipelines branch December 11, 2024 22:59
@@ -0,0 +1,198 @@
# Pipelines and Command Lists

We have seen how to write simple commands, where a command is followed by arguments.
Copy link
Member

Choose a reason for hiding this comment

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

Link to the prior lesson?

# Pipelines and Command Lists

We have seen how to write simple commands, where a command is followed by arguments.
Now we will see how to make more complex commands by composing simple commands.
Copy link
Member

Choose a reason for hiding this comment

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

"by combining simple commands"

Composing means writing. Composing simple commands gives you simple commands.


## Input and Output

Before we start, a quick introduction to input/output.
Copy link
Member

Choose a reason for hiding this comment

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

"to input and output (I/O or IO)"


Before we start, a quick introduction to input/output.

Processes have "standard I/O channels".
Copy link
Member

Choose a reason for hiding this comment

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

I/O should be defined before being used.
Channels might be worth definig.

"Processes interact with other processes (or users) by transmitting data across channels. Data going into the process is input (such as a user typing numbers into a calculator) while data coming out of the process is output (such as the result of a calculation or an error message)."

Comment on lines +12 to +14
* A process can consume _input_ on "stdin".
* A process can emit _output_ on "stdout".
* A process can emit _error output_ on "stderr".
Copy link
Member

Choose a reason for hiding this comment

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

I would expand those first. "on stand out (stdout)"

Copy link
Member

Choose a reason for hiding this comment

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

This might be a good place to explain how multiple, distinct channels (STDOUT and STDERR) can both write to the same destination (the terminal) then mention later how the pipe redirects one but not the other.


## Pipelines

This is one of the "killer features" of shell programming.
Copy link
Member

Choose a reason for hiding this comment

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

s/This/Pipelines/
"This" references a prior idea. A new paragraph should generally not be attached to a prior idea.

## Pipelines

This is one of the "killer features" of shell programming.
Pipelines allow you create sophisticated transformations on a stream of text.
Copy link
Member

Choose a reason for hiding this comment

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

s/create/perform

cat /etc/passwd | cut -d : -f 1 | sort
```

The pipe symbol (`|`) connects the output of one command to the input of another.
Copy link
Member

Choose a reason for hiding this comment

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

stderr was defined out "output" (error output) earlier. One might think the | would redirect STDERR


A command list is a sequence of pipelines separated by `;` (or newline), `&&` or `||`.

* `A; B` is a command list where `B` executes after `A` has completed.
Copy link
Member

Choose a reason for hiding this comment

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

s/executes/always executes/

#### Reading blocks of lines from a file

Suppose you have a data file containing data about triangles,
and a triangle is represented by three separate lines holding the sides of the triangle.
Copy link
Member

Choose a reason for hiding this comment

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

One line per sentence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants