⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Predicates for checking if one or all elements of a collection satisfy a condition #44

@laszloesl

Description

@laszloesl

Hey,

I wonder if you are planning on adding a way to describe exists (or any) and all first order predicates to extend the logical operators.

Something like:

iex> Predicator.evaluate!("ANY x in results: x.age >= 25", %{"results" => [%{"score" => 92, "age" => 25}, %{"score" => 10, "age" => 1}]})
{:ok, true}

iex> Predicator.evaluate!("ALL x in results: x.age >= 25", %{"results" => [%{"score" => 92, "age" => 25}, %{"score" => 10, "age" => 1}]})
{:ok, false}

This would be a useful extension. I'm happy to try to give it a shot and create a PR if you think this makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions