Anonymous user
Stable marriage problem: Difference between revisions
m
→{{header|zkl}}: update
m (→The solution) |
m (→{{header|zkl}}: update) |
||
Line 7,346:
{{trans|PicoLisp}}
<lang zkl>var
Boys=
"abe", "abi eve cath ivy jan dee fay bea hope gay".split(),
"bob", "cath hope abi dee eve fay bea jan ivy gay".split(),
Line 7,357:
"ian", "hope cath dee gay bea abi fay ivy jan eve".split(),
"jon", "abi fay jan gay eve bea dee cath ivy hope".split(), ),
Girls=
"abi", "bob fred jon gav ian abe dan ed col hal".split(),
"bea", "bob abe col fred gav dan ian ed jon hal".split(),
Line 7,370:
Couples=List(); // ( (boy,girl),(boy,girl),...)
Boyz:=Boys.pump(
while( bgs:=Boyz.filter1( 'wrap([(Boy,gs)]){ // while unattached boy
gs and (not Couples.filter1("holds",Boy))
|