README improvements#18
Conversation
- 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 |
There was a problem hiding this comment.
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
endMaybe there is a more didactic example than this.
There was a problem hiding this comment.
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."There was a problem hiding this comment.
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?
PipelessPipes.jltoChain.jl)