Generators

  • cal — Display a calendar.
  • generate — Generate a list of values by successively invoking a closure.
  • seq — Output sequences of numbers.
  • seq char — Print a sequence of ASCII characters.
  • seq date — Print sequences of dates.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.

Tips

Intro

seq builds a range of numbers.

seq 1 3 | math sum

length counts the numbers seq made.

seq 1 4 | length

Basic

Sum a sequence, then take abs.

seq 1 4 | math sum | math abs

seq char walks letters.

seq char a c | length | math abs

Intermediate

Sum a sequence and count the text.

seq 1 5 | math sum | into string | str length

Add one to each generated number.

seq 1 3 | each {|n| $n + 1} | math sum

Advanced

Four steps from a sequence to a count.

seq 1 4 | math sum | into string | str length | math abs