From 94ba112360c7aefc6f42ed619de97747f8d7f973 Mon Sep 17 00:00:00 2001 From: edef Date: Thu, 1 May 2025 15:02:04 +0000 Subject: [PATCH] docs(snix/eval/intersectAttrs): simplify algorithm description It's literally just an intersecting merge sort. Change-Id: Icc59928091c48130a4616476fc103ef33aee21e4 Reviewed-on: https://cl.snix.dev/c/snix/+/30374 Reviewed-by: Florian Klink Tested-by: besadii --- snix/eval/src/builtins/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/snix/eval/src/builtins/mod.rs b/snix/eval/src/builtins/mod.rs index a99a96571..6ca49674a 100644 --- a/snix/eval/src/builtins/mod.rs +++ b/snix/eval/src/builtins/mod.rs @@ -803,11 +803,8 @@ mod pure_builtins { let mut left = left_keys.next().unwrap(); let mut right = right_keys.next().unwrap(); - // Calculate the intersection of the attribute sets by simultaneously - // advancing two key iterators, and inserting into the result set from - // the right side when the keys match. Iteration over Nix attribute sets - // is in sorted lexicographical order, so we can advance either iterator - // until it "catches up" with its counterpart. + // Calculate the intersection of two attribute sets by iterating them + // simultaneously in lexicographic order, similar to a merge sort. // // Only when keys match are the key and value clones actually allocated. //