added one more example.
This commit is contained in:
parent
70283100fc
commit
6f2876baf9
|
@ -66,6 +66,11 @@ impl Command for Reduce {
|
|||
description: "Sum values with a starting value (fold)",
|
||||
result: Some(Value::test_int(20)),
|
||||
},
|
||||
Example {
|
||||
example: r#"[[foo baz] [baz quux]] | reduce --fold "foobar" {|it, acc| $acc | str replace $it.0 $it.1}"#,
|
||||
description: "Iteratively perform string replace (from left to right): 'foobar' -> 'bazbar' -> 'quuxbar'",
|
||||
result: Some(Value::test_int("quuxbar")),
|
||||
},
|
||||
Example {
|
||||
example: r#"[ i o t ] | reduce --fold "Arthur, King of the Britons" {|it, acc| $acc | str replace --all $it "X" }"#,
|
||||
description: "Replace selected characters in a string with 'X'",
|
||||
|
|
Loading…
Reference in New Issue
Block a user