Ahhh. Never mind. I appear to have misread your post. That said there is an issue with the SEXP I noticed while I was reading your post and I thought that you'd noticed the same one.
The problem is that every SEXP argument has a type it can be a ship name, subsystem name, string, number (positive or positive/negative), message priority or whatever. But there is no way for Freespace to determine the type of the argument. Freespace simply assumes that FRED has written out the arguments in a certain order. This actually limits us in what we can make a SEXP do (and greatly limits what improvements we can make to existing SEXPs for that matter).
Version 1
is-primary-weapon
-ship name
-weapon name
-bank (optional)
This is what I described at first. You give the name of the weapon and the ship and it will check if the weapon is there. If you give a bank it would only check that bank. If you want to check more than one ship you'd have to use an <argument> for the ship name. If you want to check multiple ships for multiple weapons it gets rather complicated. You'd have to use multiple SEXPs or <arguments> within <arguments>.
Version 2
is-primary-weapon
-weapon name
-ship 1 <--------------- Start looping at this point
-ship 2
Moving the ship name below the weapon name means that I can now make the game loop through a list of ships instead of simply having one. It will return true if ALL of them carry the weapon. I can use <argument> to make the SEXP work with multiple weapons for multiple ships. Note that the option to specify a bank has vanished.
Version 3
is-primary-weapon
-weapon name
-weapon bank
-ship 1 <--------------- Start looping at this point
-ship 2
As above but now you can specify a weapon bank too. However the bank is no longer optional. You must include the bank which means I'd need to code in a Weapon Bank type if one doesn't exist. This makes coding this SEXP take twice as long. However I'm not the kind to be slapdash with SEXPs so since any SEXP like this should include a method to specify the bank, this is the one I'd have to do. If I was feeling lazy I might simply use a number and have -1 mean all banks but quite frankly I find that rather sloppy coding too.
So why you might ask can't I just code this
is-primary-weapon
-weapon name
-ship 1 <--------------- Start looping at this point
-ship 2 <----------------End loop
-weapon bank (optional)
Well the problem is that there is no way for FS2 to determine the type of argument and realise that you're talking about weapon banks and not a ship called 1, 2 or whatever bank number you are looking for. There's no way of telling it "This isn't a ship. End the loop and move on to the next piece of code."
Version 4
is-primary-weapon
-ship name
-weapon bank
-weapon 1 <--------------- Start looping at this point
-weapon 2
Same as 3 but this time you loop through weapons on one ship and use <argument> if you want to do that for multiple ships.
That means that version 3 or 4 is probably what you're going to get as they're much more flexible than the other two.