Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b6a153b
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
985b329
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
4a2c3ce
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
1822a75
fix: rustfmt v4_workflow_ci_runner smoke test (CI fmt gate)
briansrls May 22, 2026
848f48e
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
52ea35a
fix(ci): SG-0 PR-body append + correct RerunNodeSet/AffectedSet types…
briansrls May 22, 2026
9253ab8
fix(ci): SG-0 pairing (c) requires dispatch keyword + gunb-ai/gunbc#3…
briansrls May 22, 2026
2d52572
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
95e0870
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
a90a613
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
ed34471
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
ae7aadf
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
4b8547b
fix(ci): v4 bootstrap compile + cross-module-ready ci_runner imports
briansrls May 22, 2026
15b22d0
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
eb81d36
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
625970a
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
948b975
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
1dc60ea
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
4bf3c8c
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
24de3c3
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
8f6ff20
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
821f011
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
f8b5148
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
429261c
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
744d092
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
33a1a52
WIP: Affected-set-driven CI runner — Bazel-replacement via lens/affec…
briansrls May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions INVARIANTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ Per **Dispatch-Discipline Mechanisms (b)** above, each **new** path added to `EX
| `src/v3/compiler/tests/integration/extdeps_sql_transport_test.rs` | **ROADMAP:** `ROADMAP.md` § **Nine lanes** row `T-PB-B` / `pb_rust_tests_outside_residual_zero`; this Rust integration receipt keeps HTTP/SQL/audit extdeps compiled by the existing v3 parser before downstream emission-target consumers rely on them. **Dissolution:** remove when extdeps transport and Phase 3 emission-target files are covered by a `.dag`-native parse/authority suite or generated test harness rather than per-file Rust `compile_to_dag` probes. **Interim ratchet:** `rest_transport_dag_compiles_cleanly` and `sql_transport_dag_compiles_cleanly` pin `dsl/extdeps/transports/rest.dag` and `dsl/extdeps/transports/sql.dag`; `http_server_extdep_dag_compiles_cleanly`, `sql_migration_extdep_dag_compiles_cleanly`, and `audit_cloudevents_extdep_dag_compiles_cleanly` pin `dsl/extdeps/http/server.dag`, `dsl/extdeps/sql/migration.dag`, and `dsl/extdeps/audit/cloudevents.dag` as parseable staged emission-target substrate. The field-sensitive companions (`http_server_target_fields_are_authoritative_substrate_edges`, `sql_migration_target_fields_bound_raw_sql_scaffold`, `audit_cloudevents_target_fields_preserve_core_names`) consume the new target-contract fields directly so they fail on raw `String`/`Int` regressions, missing SQL scaffold bounds, or CloudEvents alias drift while the first real projection consumer is still staged; the audit ratchet also locks CloudEvents core fields to branded carriers and `std.types.Timestamp` rather than raw strings. |
| `src/v3/compiler/tests/integration/v4_extdeps_react_dag_smoke_test.rs` | **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`; **TASKS.md** T-4.7 (`src/v4/extdeps/frameworks/react.dag`, React 19.2.0–pinned framework substrate). **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the smoke harness. **Dissolution:** remove when `src/v4/extdeps/frameworks/react.dag` (or the v4 extdeps fixture set it belongs to) is exercised only by `.dag` `TestClaim` rows / a generated harness without this per-file Rust `compile_to_dag` probe. **Interim ratchet:** `v4_extdeps_react_dag_compiles` asserts `compile_to_dag` succeeds with empty `dag.diagnostics()` for the pinned `include_str!` source. |
| `src/v3/compiler/tests/integration/v4_extdeps_file_system_dag_smoke_test.rs` | **TASKS.md** T-4.5 / Wave-2-C2 (`src/v4/extdeps/file_system.dag` — external file-system resource + modeled read/write effects; Practice 11 companion: no `import v4.std.node`, no `NodeFileBinding`; POSIX substrate exports retained for `posix.dag` / `testgen.dag`). **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`. **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the smoke harness. **Dissolution:** remove when `file_system.dag` is exercised only by `.dag` `TestClaim` rows / a generated harness without this per-file Rust probe. **Interim ratchet:** `v4_extdeps_file_system_dag_tokenizes_and_parses` plus Practice-11 companion tests (parse-surface import/type bans, POSIX-grounded `FilePath`, per-operation receipt record shapes, Wave-2 `ModeledFileEffects.file_read`/`file_write` arrow signatures + legacy `FileSystemOperations` / request-carrier coexistence). |
| `src/v3/compiler/tests/integration/v4_workflow_ci_runner_dag_smoke_test.rs` | **TASKS.md** T-21 + T-24 Wave-0 (`src/v4/workflow/ci.dag` — `ci_select_from_*` under canonical `v4.workflow.ci`; `affected_set_rerun_nodes` → `List<TestClaim>`; narrow = identity-aware subtree frontier in `verification.dag`; fail-closed = full roster; `src/v4/test/claim/workflow/affected_set_ci_runner.dag` structural receipts). **Tracked substrate bridge:** `verification.dag` `test_claim_ci_selection_fail_closed` carries 🟡 gated Practice-10 predicate-dissolution mark (dissolve when `ci_select` consumes `TestClaimCacheKey` from `05_eval`). **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`. **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the smoke harness. **Dissolution:** remove when Node-level TestClaim CI selection is exercised only by `.dag` `TestClaim` rows / generated harness / host runner without this parse probe (full wire: edit-locus + `TestClaimExerciseSurface` + `ci.yml` — follow-on A/B/C). **Interim ratchet:** `v4_workflow_ci_dag_tokenizes_and_parses`; `v4_workflow_ci_test_claim_selection_entrypoints`; `v4_workflow_affected_set_ci_runner_claim_*` — tokenize+parse + import/entrypoint wiring receipts. |
| `src/v3/compiler/tests/integration/v4_test_bootstrap_infra_closeout_test.rs` | **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`; **TASKS.md** **T-19** (`src/v4/lens/testgen.dag`) + **T-20** (`src/v4/workflow/bootstrap.dag`) + **T-22** (`src/v4/compiler/05_eval.dag` DiagnosticAssert execution / `eval_rejected_assert_kind_deferred` dissolution; witnesses in `src/v4/test/claim/manual/diagnostic_assert_eval.dag`). **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the closeout ratchet; T-22 expansion in this PR updates this row (same path — no new census line). **Dissolution:** remove when the T-19/T-20/T-22 closeout checks are expressed as `.dag` `TestClaim` rows or generated harness coverage without this host parse-surface ratchet. **Interim ratchet:** `t19_testgen_concept_surface_stays_closed_and_classified` checks the closed testgen scheduling arms and the `Generator` claim kind / anchor / classification / slot field set; `t19_language_behavior_equivalence_generated_claims_parse` / `t19_language_behavior_equivalence_run_test_claim_receipts_present` pin the LBE generator slice; `t19_idempotent_operation_generated_claims_parse_and_pin_emission` pins the idempotent-operation generator slice (`src/v4/std/effects.dag` canonical `IdempotentShape`/`EffectShape` witnesses + `idempotent_operation_witness_node`; outside the six-way `TestgenConcept` coproduct; label-only skip); `t19_manual_manifest_matches_claim_anchor_discriminants` checks manual claim anchors join to the manifest by `T19ManualAnchorKey`; `t20_bootstrap_plan_keeps_self_hosting_chain_as_data` checks the seed/self0/self1/fixpt bootstrap chain is encoded as `CompileStage` / `BootstrapPlan` data; `t22_diagnostic_assert_eval_witnesses_parse` checks `diagnostic_assert_eval.dag` parses; `t22_eval_diagnostic_assert_not_deferred_in_substrate` checks `05_eval.dag` no longer contains `eval_rejected_assert_kind_deferred`, executes `DiagnosticAssert`, and routes `run_test_claim` through `aggregate_verdicts`. |
| `src/v3/compiler/tests/integration/coverage_defect_acceptance_dag_test.rs` | **Coverage-defect acceptance keys:** `src/v4/lens/coverage.dag` carries the canonical coverage-key set for `docs/design-dissolution-lens.md` §5.1; the old emit-template key is retired into `TemplateHole`, and the old string-escape key is split into `TemplateHole` plus `CanonicalCarrier`. **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`. **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the parse-level ratchet. **Dissolution:** remove when the v4 coverage lens runs as `.dag` / generated coverage and can assert the same acceptance rows without this host parser check. **Interim ratchet:** `coverage_defect_acceptance_keys_match_declared_rows` tokenizes/parses `src/v4/lens/coverage.dag` and asserts the exact parsed `(coverage_defect_* data row, CoverageDefectKey variant)` set matches the expected acceptance-key table while rejecting retired emit-template / string-escape names. |
| `src/v3/compiler/tests/integration/v4_bin_main_dag_smoke_test.rs` | **T-15** (`src/v4/bin/main.dag` — trampoline **`String`** authority + B1 digest **placeholder** `Node`s; closed-tree invariant #2 / pure-bootstrap zero-floor per `docs/design-pure-bootstrap-zero.md`). **Grounded-indicator authoring on `main.dag` is HOLD** pending hub-relayed canonical spec (operator-direct format under-spec; neat-hawk-87 cascade 2026-05-19). **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`. **PR receipt (P5 Mechanism (b)):** this INVARIANTS row + matching `EXPECTED_HAND_AUTHORED_TEST` line in `sg0_census_test.rs` land in the same PR as the smoke harness. **Dissolution:** remove when `main.dag` is exercised only by `.dag` `TestClaim` rows / a generated harness without this per-file Rust probe. **Interim ratchet:** `v4_bin_main_dag_tokenizes_and_parses_with_trampoline_source_anchor` runs `tokenize_for_test` + `parse_for_test` on the pinned `include_str!` source and asserts the trampoline / stub `data` identifiers plus the escaped `include!` spelling remain present in source text (full `compile_to_dag` on `main.dag` alone is deferred: `import v4.std.node` is not linked in the single-file harness). |
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci-merge/sg0-pr-body-append.3556.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SG-0 hand-path delta: +1

SG-0 pairing: (c) follow-up dispatch via gunb-ai/gunbc#3556 — T-21/T-24 Wave-0 net +1 on `EXPECTED_HAND_AUTHORED_TEST` for `v4_workflow_ci_runner_dag_smoke_test.rs` (INVARIANTS §P5(b) parse smoke on `workflow/ci.dag` selection entrypoints). Dissolves when Node-level TestClaim CI selection runs via `.dag` harness / host runner (subtree work-items A/B/C).
2 changes: 2 additions & 0 deletions src/v3/compiler/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ mod v4_lens_testgen_dag_smoke_test;
mod v4_std_model_core_dag_smoke_test;
#[path = "integration/v4_test_bootstrap_infra_closeout_test.rs"]
mod v4_test_bootstrap_infra_closeout_test;
#[path = "integration/v4_workflow_ci_runner_dag_smoke_test.rs"]
mod v4_workflow_ci_runner_dag_smoke_test;
#[path = "integration/value_body_substrate_mirror_isomorphism_test.rs"]
mod value_body_substrate_mirror_isomorphism_test;
#[path = "integration/common/wiring_scanner_test.rs"]
Expand Down
3 changes: 3 additions & 0 deletions src/v3/compiler/tests/integration/sg0_census_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,9 @@ const EXPECTED_HAND_AUTHORED_TEST: &[&str] = &[
// SG-0 + INVARIANTS §P5(b) receipt; dissolves when the same checks are `.dag`
// TestClaims or generated harness coverage.
"src/v3/compiler/tests/integration/v4_test_bootstrap_infra_closeout_test.rs",
// T-21/T-24: `workflow/ci.dag` Wave-0 selection consumes `RerunNodeSet` for TestClaim roster narrowing.
// SG-0 + INVARIANTS §P5(b) receipt; dissolves when `.dag` TestClaim harness replaces probe.
"src/v3/compiler/tests/integration/v4_workflow_ci_runner_dag_smoke_test.rs",
// §1.8 gate #96 (`value_body_substrate_mirror_isomorphism_executable`):
// CI-visible generated Rust `ValueBody` mirror vs `substrate.dag`
// constructor isomorphism. Dissolves when `ValueBody` no longer has a
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
//! **Layer:** integration
//!
//! T-21/T-24 Wave-0: `src/v4/workflow/ci.dag` (`v4.workflow.ci`) exposes affected-set-driven
//! `TestClaim` roster selection over `RerunNodeSet` (kernel `filter`/`any`/`contains`;
//! evaluation-node projection in `verification.dag`). Receipt
//! claims live in `src/v4/test/claim/workflow/affected_set_ci_runner.dag`.
//!
//! **TESTING.md:** M1(2.7) tokenize/parse gate; full `compile_to_dag` import merge
//! deferred until cross-module v4 load lands (same posture as peer v4 smoke tests).
//!
//! **ROADMAP:** `ROADMAP.md` § **Nine lanes** row **T-PB-B** / `pb_rust_tests_outside_residual_zero`;
//! **TASKS.md** T-21 + T-24.
//!
//! **Dissolution:** remove when `.dag` TestClaim execution covers these claims without
//! this hand-Rust parse harness.

use v3_compiler::parse_for_test;
use v3_compiler::parse_surface::SurfaceItem;
use v3_compiler::tokenize_for_test;

const CI_DAG: &str = include_str!("../../../../v4/workflow/ci.dag");
const CI_DAG_PATH: &str = "src/v4/workflow/ci.dag";
const CLAIM_DAG: &str =
include_str!("../../../../v4/test/claim/workflow/affected_set_ci_runner.dag");
const CLAIM_PATH: &str = "src/v4/test/claim/workflow/affected_set_ci_runner.dag";

fn parse_module(source: &str, path: &str) -> v3_compiler::parse_surface::SurfaceModule {
let tokens =
tokenize_for_test(source, path).unwrap_or_else(|e| panic!("{path}: tokenize: {e:?}"));
parse_for_test(&tokens, path).unwrap_or_else(|e| panic!("{path}: parse: {e:?}"))
}

fn module_paths(module: &v3_compiler::parse_surface::SurfaceModule) -> Vec<Vec<&str>> {
module
.items
.iter()
.filter_map(|item| match item {
SurfaceItem::Module { path, .. } => {
Some(path.iter().map(String::as_str).collect::<Vec<_>>())
}
_ => None,
})
.collect()
}

fn import_includes_name(
module: &v3_compiler::parse_surface::SurfaceModule,
path: &[&str],
name: &str,
) -> bool {
module.items.iter().any(|item| {
let SurfaceItem::Import {
path: item_path,
names,
..
} = item
else {
return false;
};
item_path.len() == path.len()
&& item_path
.iter()
.zip(path.iter())
.all(|(a, &b)| a.as_str() == b)
&& names.iter().any(|n| n == name)
})
}

fn surface_declares_fn(module: &v3_compiler::parse_surface::SurfaceModule, name: &str) -> bool {
module.items.iter().any(|item| match item {
SurfaceItem::Fn {
name: item_name, ..
}
| SurfaceItem::FnExternalBody {
name: item_name, ..
} => item_name == name,
_ => false,
})
}

fn surface_declares_test_claim_data(
module: &v3_compiler::parse_surface::SurfaceModule,
name: &str,
) -> bool {
use v3_compiler::parse_surface::SurfaceType;
module.items.iter().any(|item| match item {
SurfaceItem::Data {
name: item_name,
ty: SurfaceType::Named { name: ty_name, .. },
..
} => item_name == name && ty_name == "TestClaim",
_ => false,
})
}

#[test]
fn v4_workflow_ci_dag_tokenizes_and_parses() {
let _module = parse_module(CI_DAG, CI_DAG_PATH);
}

#[test]
fn v4_workflow_ci_test_claim_selection_entrypoints() {
let module = parse_module(CI_DAG, CI_DAG_PATH);
assert_eq!(
module_paths(&module),
vec![vec!["v4", "workflow", "ci"]],
"{CI_DAG_PATH}: module authority path"
);
for name in [
"ci_select_from_rerun_nodes",
"ci_select_from_affected_set",
"test_claim_in_rerun_frontier",
] {
assert!(
surface_declares_fn(&module, name),
"{CI_DAG_PATH}: must declare {name}"
);
}
assert!(
import_includes_name(
&module,
&["v4", "lens", "affected_set"],
"affected_set_rerun_nodes"
),
"{CI_DAG_PATH}: must import affected_set_rerun_nodes from T-21 lens"
);
assert!(
import_includes_name(
&module,
&["v4", "std", "verification"],
"test_claim_evaluation_touches_rerun_frontier"
),
"{CI_DAG_PATH}: must import subtree-aware frontier membership from verification"
);
assert!(
import_includes_name(
&module,
&["v4", "std", "verification"],
"test_claim_ci_selection_fail_closed"
),
"{CI_DAG_PATH}: must import fail-closed diagnostic selection guard from verification"
);
assert!(
import_includes_name(&module, &["v4", "std", "algebra"], "filter"),
"{CI_DAG_PATH}: must import filter from std.algebra"
);
}

#[test]
fn v4_workflow_affected_set_ci_runner_claim_dag_tokenizes_and_parses() {
let _module = parse_module(CLAIM_DAG, CLAIM_PATH);
}

#[test]
fn v4_workflow_affected_set_ci_runner_claim_wiring() {
let module = parse_module(CLAIM_DAG, CLAIM_PATH);
assert_eq!(
module_paths(&module),
vec![vec![
"v4",
"test",
"claim",
"workflow",
"affected_set_ci_runner"
]],
"{CLAIM_PATH}: module authority path"
);
for name in ["ci_select_from_rerun_nodes", "ci_select_from_affected_set"] {
assert!(
import_includes_name(&module, &["v4", "workflow", "ci"], name),
"{CLAIM_PATH}: must import {name} from canonical workflow/ci authority"
);
}
for claim in [
"ci_runner_narrow_selection_claim",
"ci_runner_fail_closed_superset_claim",
"ci_runner_shape_collision_claim",
"ci_runner_inner_frontier_claim",
] {
assert!(
surface_declares_test_claim_data(&module, claim),
"{CLAIM_PATH}: must declare structural receipt `{claim}`"
);
}
assert!(
surface_declares_fn(&module, "ci_runner_narrow_selection_holds")
&& surface_declares_fn(&module, "ci_runner_fail_closed_superset_holds")
&& surface_declares_fn(&module, "ci_runner_shape_collision_holds")
&& surface_declares_fn(&module, "ci_runner_inner_frontier_holds"),
"{CLAIM_PATH}: receipt predicates must exercise ci selection entrypoints"
);
}
11 changes: 7 additions & 4 deletions src/v4/extdeps/languages/swift.dag
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,14 @@ fn swift_nonnumeric_representation_node(facts: SwiftNonNumericPrimitiveFacts) ->

fn swift_nonnumeric_scalar_classifier_node(facts: SwiftNonNumericPrimitiveFacts) -> Node {
match facts {
SwiftBoolPrimitiveFacts { representation: _ } => swift_atom(id: swift_tag_scalar_bool)
SwiftCharacterPrimitiveFacts { representation: _ } =>
SwiftBoolPrimitiveFacts { surface_spelling: _, representation: _ } =>
swift_atom(id: swift_tag_scalar_bool)
SwiftCharacterPrimitiveFacts { surface_spelling: _, representation: _ } =>
swift_atom(id: swift_tag_scalar_character)
SwiftStringPrimitiveFacts { representation: _ } => swift_atom(id: swift_tag_scalar_string)
SwiftVoidPrimitiveFacts { representation: _ } => swift_atom(id: swift_tag_scalar_void)
SwiftStringPrimitiveFacts { surface_spelling: _, representation: _ } =>
swift_atom(id: swift_tag_scalar_string)
SwiftVoidPrimitiveFacts { surface_spelling: _, representation: _ } =>
swift_atom(id: swift_tag_scalar_void)
}
}

Expand Down
25 changes: 25 additions & 0 deletions src/v4/std/algebra.dag
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,31 @@ fn for_all<T>(xs: FreeMonoid<T>, predicate: fn(T) -> Bool) -> Bool {
}


fn any<T>(xs: FreeMonoid<T>, predicate: fn(T) -> Bool) -> Bool {
fold_list(xs: xs, empty: false, cons: fn(acc, item) {
match acc {
true => true
false => predicate(item)
}
})
}


fn filter<T>(xs: FreeMonoid<T>, predicate: fn(T) -> Bool) -> FreeMonoid<T> {
fold_list_right(xs: xs, empty: Empty, snoc: fn(acc, item) {
match predicate(item) {
true => Cons { head: item, tail: acc }

This comment was marked as resolved.

false => acc
}
})
}


fn contains<T>(xs: FreeMonoid<T>, item: T, eq: fn(T, T) -> Bool) -> Bool {
any(xs: xs, predicate: fn(candidate) { eq(candidate, item) })
}


fn count_where<T>(xs: FreeMonoid<T>, predicate: fn(T) -> Bool) -> Int {
fold_list(xs: xs, empty: 0, cons: fn(count, item) {
match predicate(item) {
Expand Down
Loading
Loading