W3cubDocs

/Nushell

lazy make for core

Create a lazy record.

Signature

> lazy make {flags}

Flags

  • --columns, -c {list<string>}: Closure that gets called when the LazyRecord needs to list the available column names
  • --get-value, -g {closure(string)}: Closure to call when a value needs to be produced on demand

Input/output types:

input output
nothing record

Examples

Create a lazy record

>lazy make--columns ["haskell", "futures", "nushell"] --get-value { |lazything| $lazything+"!" }

Test the laziness of lazy records

>lazy make-c ["hello"] -g { |key| print$"getting ($key)!";$key|str upcase }

Notes

Lazy records are special records that only evaluate their values once the property is requested. For example, when printing a lazy record, all of its fields will be collected. But when accessing a specific property, only it will be evaluated.

    Note that this is unrelated to the lazyframes feature bundled with dataframes.

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/lazy_make.html