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

README improvements #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

waldyrious
Copy link
Contributor

  • Add a simpler introductory example (inspired by this Discourse post by @Satvik)
  • Rename "Example" section to "Usage" and make the two next sections into subsections of it
  • Normalize headings to sentence case
  • Reword a couple sentences to adjust to the package rename (from PipelessPipes.jl to Chain.jl)
  • Add a link to DataFrames.jl

- Add a simpler introductory example
- Rename "Example" section to "Usage"
  and make the two next sections into subsections of it
- Normalize headings to sentence case
- Reword a couple sentences to adjust to the package rename
  (from `PipelessPipes.jl` to `Chain.jl`)
- Add a link to DataFrames.jl

```julia
julia> @chain 1:3 begin
_ .+ 1
Copy link
Owner

@jkrumbiegel jkrumbiegel Mar 7, 2021

Choose a reason for hiding this comment

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

In principle I'm not opposed to adding a simple non-DataFrame example. But _ .+ 1 and _ .^ 2 show the same syntax twice, which doesn't show off the range of options.

This for example shows a couple different things you can do:

@chain 1:10 begin
	  _ .^ 2
	  mod.(5)
	  filter(iseven, _)
	  sum
end

Maybe there is a more didactic example than this.

Copy link
Owner

Choose a reason for hiding this comment

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

What about this:

julia> names = ["ursula", "alice", "iris", "olga", "erica"]
5-element Vector{String}:
 "ursula"
 "alice"
 "iris"
 "olga"
 "erica"

julia> @chain names begin
    filter(contains("a"), _)
    @. uppercasefirst
    sort
    join(" and ")
    "$_ have an 'A' in their name."
end
"Alice and Erica and Olga and Ursula have an 'A' in their name."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point — but I believe it makes sense for the very first example to aim for a demonstration of the basic structure of a chained block, rather than showcasing the variety of possibilities. With that in mind, I would maybe start with the first example you offered above, and show the second one next. This way we can keep the advantages of both. WDYT?

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.

2 participants