code wiki / _hdl_build / nx_connect_match_lib.nx

nx_connect_match_lib.nx

buildroot/runtime/_hdl_build/nx_connect_match_lib.nx

4041 B81 linesdepth 0pulls 0 transitivereach 13 importersview sourcekind librarytopic connect
docsdependenciesstructsconstsfunctions

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

nx_connect_match_lib.nx nx_connect_api_lib.nx nx_connect_match.nx nx_connect_serve.nx

imports: none

imported by: nx_connect_api_lib.nxnx_connect_match.nxnx_connect_serve.nx

structs

none

consts

18const MX_LANE_LANG: i64 = 0
19const MX_LANE_FRIEND: i64 = 1
20const MX_LANE_COMMUNITY: i64 = 2
21const MX_LANE_DATE: i64 = 3
22const MX_MINOR_AGE: i64 = 18
23const MX_EXCLUDED: i64 = 0-1 // by-construction exclusion sentinel (negative, never a low score)

functions

26func mx_inter_popc(a: i64, b: i64) -> i64
39func mx_clamp100(v: i64) -> i64 { if v > 100 { return 100 } return v }
42func mx_hm(a: i64, b: i64) -> i64
called by 1: mx_recip_score
49func mx_recip_score(al: i64, at: i64, bl: i64, bt: i64) -> i64
59func mx_recip_arith(al: i64, at: i64, bl: i64, bt: i64) -> i64
called by 1: main calls 2: mx_inter_popcmx_clamp100
67func mx_interest_score(ai: i64, bi: i64) -> i64
73func mx_match_weight(a_age: i64, a_learn: i64, a_teach: i64, a_int: i64,