mirror of
https://github.com/nushell/nushell.git
synced 2024-12-30 19:09:15 +01:00
e281c03403
# Description Close: #12083 Close: #12084 # User-Facing Changes It's a breaking change because we have switched the position of `<initial>` and `<closure>`, after the change, initial value will be optional. So it's possible to do something like this: ```nushell > let f = {|fib = [0, 1]| {out: $fib.0, next: [$fib.1, ($fib.0 + $fib.1)]} } > generate $f | first 5 ╭───┬───╮ │ 0 │ 0 │ │ 1 │ 1 │ │ 2 │ 1 │ │ 3 │ 2 │ │ 4 │ 3 │ ╰───┴───╯ ``` It will also raise error if user don't give initial value, and the closure don't have default parameter. ```nushell ❯ let f = {|fib| {out: $fib.0, next: [$fib.1, ($fib.0 + $fib.1)]} } ❯ generate $f Error: × The initial value is missing ╭─[entry #5:1:1] 1 │ generate $f · ────┬─── · ╰── Missing intial value ╰──── help: Provide <initial> value in generate, or assigning default value to closure parameter ``` # Tests + Formatting Added some test cases. --------- Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com> |
||
---|---|---|
.. | ||
commands | ||
format_conversions | ||
main.rs |