Skip to content

Test or remove mapDropping #394

@tjpalmer

Description

@tjpalmer

We've never tested this method:

  /**
   * Maps elements using [transform] and filtering out elements for which
   * [transform] fails.
   */
  @connected("Listed::mapDropping")
  public mapDropping<O>(transform: fn (T): O throws Bubble): List<O>;

Some options:

  • Test it, and implement it backends that don't yet (csharp, js, rust)
  • Change it to nullable instead of throwing, and test/implement it
  • Remove it for now

Here's a potential addition to the list ops funtest for the current mapDropping:

    console.log(
      "Odd  ${
        ls.mapDropping { (x: Int): Int throws Bubble =>
          if ((x & 1) != 0) {
            x * 2
          } else {
            bubble()
          }
        }.join(", ") { x => x.toString() }
      } (doubled to even)"
    );
Odd  2, 6, 10, 14, 18 (doubled to even)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions