Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.4.0
    • Component/s: Docs
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2016-02-10
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      The function reverse_each has bee added. It works like the each function but iterates over elements in reverser order. This function in contrast to stdlib's reverse does not create a new reversed copy which makes it ideal for chaining into other Iterable functions. Also see the new puppet data types Iterable and Iterator.
      Show
      The function reverse_each has bee added. It works like the each function but iterates over elements in reverser order. This function in contrast to stdlib's reverse does not create a new reversed copy which makes it ideal for chaining into other Iterable functions. Also see the new puppet data types Iterable and Iterator.

      Description

      Add a reverse_each(iterable) function that takes one argument and an optional block. The declared parameter type must be `Iterable`.

      If the function is called without a block, it must return a new iterable that will yield each element of the given argument in reverse order.
      When a block is given, it must be called with each element of the given argument in reverse order. The argument is then returned.

      Example:

      [1,3,5,7].reverse_each |$x| { notice($x) }
      

      will result in the notices '7', '5', '3', '1'

      $c = [1,3,5,7].reverse_each.map |$x| { $x * 10 }
      

      Will result in:

      $c == [70, 50, 30, 10].
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thomas.hallgren Thomas Hallgren
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support