I was wondering if it is possible to override the head of symbols/operators. As a motivating example if I run:
Then Ket will be returned. But lets say I want Bob to be returned instead of Ket. Is such a thing possible? To go a little bit further, I'd like:
to return BobKet and
to return AliceKet so that I could make a function that recognizes these heads like:
Thanks!
Here are the corresponding lines of code
Head[Ket[\[Placeholder]]]
Head[Ket[Subscript[x, B]]]
Head[Ket[Subscript[x, A]]]
combineBobAndAlice[b_BobKet, a_AliceKet] := Ket[{ {Subscript[b[[1, 1]], B], Subscript[a[[1, 1]], A]} }]
Comments
Post a Comment