← ZL256 task inventory
scaffoldCore-1 previewrevision 2

Rational Numbers

algorithm/rational-numbers
algorithminterpretedcompiledinterpretercllvm-jitaot

Public context

What an implementation receives

# Rational Numbers Normalize sign and divide numerator and denominator by their greatest common divisor. Submit the complete source closure matching `interface.zli`. Public cases are examples, not an exhaustive specification. Do not use ambient I/O, time, random state, or undeclared capabilities.

Public interfaceZergLang
module benchmark_algorithm_rational_numbers;

public value Solution {
    public interpreted algorithm message solve(type: Class<Self>, input: Dynamic)
        -> Dynamic effects {};
}

Public cases

1 inspectable case

0ba4d988-044c-4ed5-9215-4d0bb8d0ae9fpublic input + expected behavior
Input
{
  "fields": [
    {
      "name": "r1",
      "value": {
        "items": [
          {
            "type": "integer",
            "value": "1"
          },
          {
            "type": "integer",
            "value": "2"
          }
        ],
        "type": "sequence"
      }
    },
    {
      "name": "r2",
      "value": {
        "items": [
          {
            "type": "integer",
            "value": "2"
          },
          {
            "type": "integer",
            "value": "3"
          }
        ],
        "type": "sequence"
      }
    },
    {
      "name": "canonical_property",
      "value": {
        "type": "text",
        "value": "add"
      }
    }
  ],
  "type": "record"
}
Expected
{
  "kind": "value",
  "value": {
    "items": [
      {
        "type": "integer",
        "value": "7"
      },
      {
        "type": "integer",
        "value": "6"
      }
    ],
    "type": "sequence"
  }
}

Held-out inputs and expectations are excluded from this projection. Their published outcomes are aggregate-only.

Code entry

ZergLang source policy

Active reference source withheld

This task participates in model synthesis. Publishing its canonical solution would invalidate future evaluations; the prompt, interface, and public cases above are the complete public authoring context.

Execution contract

algorithm

Selector
benchmark_algorithm_rational_numbers.Solution.solve
Executors
algorithm-interpreter, algorithm-c, algorithm-llvm-jit, algorithm-aot
Platforms
portable
Performance lane
not eligible

Normative authority

1 bound clauses

Official task history

Signed conformance observations

No official conformance run currently contains this task revision in its signed catalog.

Provenance

Where this task came from

[
  {
    "commit": "03f83310ed0547b902d211a05d23b3d74661df02",
    "kind": "adapted",
    "license": "MIT",
    "source": "Exercism problem-specifications"
  }
]