Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • harlowe harlowe
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 54
    • Issues 54
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Games
  • harloweharlowe
  • Issues
  • #8
Closed
Open
Issue created Nov 29, 2015 by Leon Arnott@leonMaintainer

Allow (count:) to accept multiple values

Currently, (count:) is essentially a slightly different contains operator - returning a number instead of a boolean. Also, both are limited by the fact that they can only check for one item's presence - you can't do contains ...$vals, and you can't do (count: ...$vals).

(count:) can be easily expanded to cope with multiple values - its signature will be (count: Any, [...Any]). It would return the sum of occurrences of each of the values. It would also be altered to apply to datamaps and datasets (as they would no longer necessarily always return 1 or 0). As a result, one could modify (count:) to check for the unique presence of values by wrapping the container in either (datanames:) (for datamaps) or (dataset:) (for arrays), to filter for unique values.

An aside: originally, I'd envisioned the reverse expansion of (count:) - it would accept one value, and you could supply a sequence to it. This is no longer practical due to the current signature of (count:) explicitly accepting a collection, in first position. And, it would essentially be a re-phrasing of the current state of (count:) in terms of semantics.

Question: similar "data structure query" macros are (datanames:) and (datavalues:). Should they be expanded to be variadic, accepting multiple datamaps?

Other question: should there be a (contains-all:) macro, which can provide a more convenient check that every value is in the given container? Or maybe that should be a new contains all operator?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking