true and false are bool values. You can use them as keys in a map whose key type is bool. a < b is an expression that resolves to a boolean value, just like a - b resolves to an integer value. Because a < b resolvest to a bool value, you can use it as a key to your map[bool]int
EDIT: My example didn’t do the exact same thing. I think I got it right now!
Well, its a trick. However this is not idiomatic and definitely not recommended to use such as constructions because your code will become unreadable. Use if/else instead, the resulted code is enough optimal.
BTW the code does not completely replicate the ternary operator (at least how it gets evaluated in most languages).
<predicate> ? <consequent> : <alternative>
in most languages if the predicate is an expression that evaluates to true then only the <consequent> gets evaluated and the <alternative> if the <predicate> is set to false then only the <alternative> expression gets evaluated
what do you mean “become” unreadable, that mess the OP posted is ALREADY unreadable and hard to reason about at BEST. Unless the goal was obfuscation, whomever came up with that atrocity failed.