# Array set difference

`array-set-difference` · version 1.0.0 · Other utilities · free, no key needed

Return unique left-array values absent from the right array, in first-seen order.

**Use when you need to: ordered array set difference · values in left but not right · subtract one JSON array from another.**

## Decide before calling

Read the [versioned contract](/v1/tools/array-set-difference/versions/1.0.0) and the supported scope below. Reuse `array-set-difference@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `array-set-difference@1.0.0` for ordered array set difference. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- ordered array set difference
- values in left but not right
- subtract one JSON array from another
- remove matching values from array
- JSON array difference preserving order
- find items absent from second array

## Not supported

- symmetric difference
- multiset subtraction

## Behavior

- All outputs include standard_version.
- Input order is preserved when the result is set-like.
- Integers, decimal strings, and strings are compared without binary floating-point conversion.
- Pure synchronous processing with first-occurrence result ordering.

## Input

- `left` (array of any JSON value, required): max items 256
- `right` (array of any JSON value, required): max items 256

## Output

- `standard_version` (constant "RFC8785", required)
- `values` (array of any JSON value, required): max items 256

## Limits

- max input bytes: 32768
- max items: 256
- max iterations: 4095
- max output bytes: 32768

## Example

Request input:

```json
{
  "left": [
    1,
    2,
    2,
    3
  ],
  "right": [
    2
  ]
}
```

Response:

```json
{
  "result": {
    "standard_version": "RFC8785",
    "values": [
      1,
      3
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "array-set-difference",
  "version": "1.0.0",
  "input": {
    "left": [
      1,
      2,
      2,
      3
    ],
    "right": [
      2
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/array-set-difference/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"left":[1,2,2,3],"right":[2]}'
```

The machine-readable contract is at [/v1/tools/array-set-difference/versions/1.0.0](/v1/tools/array-set-difference/versions/1.0.0).

### CLI

```sh
node cli.mjs run array-set-difference 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Array set intersection](/tools/array-set-intersection): Return unique left-array values also in the right array, in first-seen order.
- [Array duplicates find](/tools/array-duplicates-find): List duplicated JSON values with counts and first indexes, preserving first-seen order.
- [Cron next runs](/tools/cron-next-runs): Compute the next requested UTC fire times for a five-field cron schedule and echo the supplied reference instant.
- [Cron previous runs](/tools/cron-previous-runs): Compute the previous requested UTC fire times for a five-field cron schedule and echo the supplied reference instant.
- [Html to plain text](/tools/html-to-plain-text): Strip HTML and script/style text, decode supported references; collapse whitespace including inside pre elements.
- [Rtf to markdown](/tools/rtf-to-markdown): Convert an 8 KiB ANSI-1252 RTF text subset to escaped Markdown; unsupported Word features are refused.
