Stable marriage problem: Difference between revisions

eliminate unneeded parenthesis and complete name change from last edit
(J: distinguish name and index variables for individuals of both genders, and other minor cleanups)
(eliminate unneeded parenthesis and complete name change from last edit)
Line 366:
galNames=: {."1 fraw
mprefs=: galNames i.( }."1 mraw)
fprefs=: guyNames i.( }."1 fraw)
propose=: dyad define
Line 406:
if. bad=. 0 e. ,stable do.
smoutput 'Better matches:'
smoutput ((guys{guyNames),:(fsgals{galNames)) {~"1 0"2 1 ($stable) #: I.,-.stable
end.
assert-.bad
6,962

edits