Symmetric difference: Difference between revisions

no edit summary
No edit summary
Line 2,824:
'b not a': <'Jim'>,
'symmetric difference': <'Jim','Serena'>></pre>
 
=={{header|Yabasic}}==
<lang Yabasic>lista1$ = "John Serena Bob Mary Serena"
lista2$ = "Jim Mary John Jim Bob"
 
lista1$ = quitadup$(lista1$)
lista2$ = quitadup$(lista2$)
res$ = quitacomun$(lista1$, lista2$)
res$ = res$ + quitacomun$(lista2$, lista1$)
print res$
 
 
sub quitadup$(l$)
l$ = l$ + " "
return quitarep$(l$)
end sub
 
 
sub quitacomun$(l1$, l2$)
l1$ = l1$ + " "
l2$ = l2$ + " "
return quitarep$(l1$, l2$)
end sub
 
 
sub quitarep$(l1$, l2$)
local pos, n, x, listar$, nombre$, largo
largo = len(l1$)
pos = 1
while(true)
n = instr(l1$, " ", pos)
if n > 0 then
nombre$ = mid$(l1$, pos, n-pos)
if numparams = 1 then
x = instr(listar$, nombre$)
else
x = instr(l2$, nombre$)
end if
if x = 0 listar$ = listar$ + nombre$ + " "
pos = n + 1
else
return listar$
end if
wend
end sub
</lang>
 
=={{header|zkl}}==
672

edits