code wiki / _hdl_build / nx_connect_match_lib.nx
nx_connect_match_lib.nx
buildroot/runtime/_hdl_build/nx_connect_match_lib.nx
about
nx_connect_match_lib.nx -- the RECIPROCAL language-exchange match engine, extracted as a shared library
so the verifying gate (nx_connect_match) and the LIVE app (nx_connect_serve /partners) bind ONE
implementation of the law. Before this split the live page printed HARDCODED scores while claiming they
came from "the gated match engine" -- the page asserted a computation it never ran. No main, no syscalls,
no allocation, so any consumer can import it.
THE LAW: language exchange is COMPLEMENTARY, not similarity. A good partner TEACHES what you want to LEARN
and LEARNS what you can TEACH, so the core signal is a HARMONIC MEAN of the two directional fits -- if
either direction is zero the pair collapses to zero, which is what makes reciprocity NECESSARY rather than
merely preferred. Shared interests modulate but can never rescue a one-sided pair. Integer only, no floats.
The output is an INTERNAL RANK WEIGHT 0..100 and must never be presented as a compatibility score (Joel &
Eastwick, PNAS 2020: partner traits explain ~5% of long-term variance).
SAFETY BY CONSTRUCTION: the dating/romance lane is UNREACHABLE to or from a minor in BOTH directions, even
when the underlying reciprocal score is perfect, while language exchange stays fully open to them.
license_tier: ORIGINAL
dependencies 0 imports · 3 importers
imports: none
imported by: nx_connect_api_lib.nxnx_connect_match.nxnx_connect_serve.nx
structs
| none |
consts
| 18 | const MX_LANE_LANG: i64 = 0 |
| 19 | const MX_LANE_FRIEND: i64 = 1 |
| 20 | const MX_LANE_COMMUNITY: i64 = 2 |
| 21 | const MX_LANE_DATE: i64 = 3 |
| 22 | const MX_MINOR_AGE: i64 = 18 |
| 23 | const MX_EXCLUDED: i64 = 0-1 // by-construction exclusion sentinel (negative, never a low score) |
functions
| 26 | func mx_inter_popc(a: i64, b: i64) -> i64 |
| 39 | func mx_clamp100(v: i64) -> i64 { if v > 100 { return 100 } return v } |
| 42 | func mx_hm(a: i64, b: i64) -> i64 called by 1: mx_recip_score |
| 49 | func mx_recip_score(al: i64, at: i64, bl: i64, bt: i64) -> i64 |
| 59 | func mx_recip_arith(al: i64, at: i64, bl: i64, bt: i64) -> i64 |
| 67 | func mx_interest_score(ai: i64, bi: i64) -> i64 |
| 73 | func mx_match_weight(a_age: i64, a_learn: i64, a_teach: i64, a_int: i64, |