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:

inputoutput
nothingrecord

Examples

Create a lazy record

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

Test the laziness of lazy records

> lazy make --columns ["hello"] --get-value { |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.