1
$\begingroup$

Let $A$ be a set and $B$ a condition (can be either true or false). Is there any shorter description of the expression $$ x = \begin{cases} A & B \\ \emptyset & \text{otherwise} \end{cases} \text{?} $$ An inline solution would be nice.

One possibility is to define $$ \text{cond}(A, B) = \begin{cases} A & B \\ \emptyset & \text{otherwise} \end{cases} $$ and set $x = \text{cond}(A, B)$. But is there a more "intuitive" way to do this without defining a new function?

$\endgroup$
1
$\begingroup$

How about $\{ x\ \lvert\ x \in A \wedge B \}$ or $\{ x \in A\ \lvert\ B \}$? I would personally stick to your original approach, though.

$\endgroup$
  • $\begingroup$ Okay, nice idea. I just wait before I mark it as answer. Maybe there is a more "intuitive" way. $\endgroup$ – Ronny Oct 21 '14 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.