Skip to content

Propose some list built-in improvements now that we have a stdlib #903

@AltGr

Description

@AltGr

Remove the sum builtins (and replace by stdlib functions)

Since it's not overloaded and requires an explicit type with a custom syntax sum money of [...], this built-in could easily be replaced by per-type stdlib functions: Money.sum content money depends on l content list of money, etc.
In this new context there is no real justification for a custom syntax.

Find in a list using a predicate

This is a pretty common operation, but it requires a predicate which is not possible at the moment with stdlib functions. At the moment, this is how it can be done:

let candidates equals
  list of element among lst such that predicate of element
in
List.first_element of candidates

This returns an optional as expected; but it is a bit verbose, which obfuscates the point.

Depending on how common this really is, it should be considered to add a new builtin such as:

find element among lst such that predicate of element

More

This is open for discussions and more suggestions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions