Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-7620

Add a `unique` function that works with all kinds of iterables

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: Functions, Language
    • Labels:
      None
    • Template:
    • Epic Link:
    • Sub-team:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-06-14
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      The function {{unique}} is now available directly in Puppet and does no longer require {{stdlib}} to be included. The new version of the function also handles {{Hash}} and {{Iterable}} data types. It is now also possible to give a code block that determines of the uniqueness is computed.
      Show
      The function {{unique}} is now available directly in Puppet and does no longer require {{stdlib}} to be included. The new version of the function also handles {{Hash}} and {{Iterable}} data types. It is now also possible to give a code block that determines of the uniqueness is computed.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      covered by unit tests

      Description

      The stdlib unique function can only process String and Array values and it is not possible to influence the comparison (it is always a Ruby == operation).

      The unique function is really intrinsic to collections and iterators and it makes sense for it to be in Puppet instead of stdlib.

      • For String and Array the function must be compatible with the stdlib version
      • The function should handle all Iterables
      • It should be possible to give the function a lambda that computes the value to do the equality/uniqueness check on.
      • For Hash the result should be a hash with associations between the sets of keys that all have values that are computed to be equal (by the built in == or by a given lambda) and the set of those values.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            henrik.lindberg Henrik Lindberg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support