Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
creating:jlists [2025/04/28 20:27] – Implemented jlist flattening ahelwer | creating:jlists [2025/05/21 18:21] (current) – Disjunction does not short-circuit ahelwer | ||
---|---|---|---|
Line 253: | Line 253: | ||
Now that we can parse jlists, let's interpret them. | Now that we can parse jlists, let's interpret them. | ||
- | Similar to the logical operators covered in the book, jlists | + | Similar to the logical operators covered in the book, conjunction lists short-circuit. |
- | This means juncts | + | That means conjuncts |
+ | In an odd contrast, disjunction lists do //not// short-circuit; | ||
Add conjunction list evaluation logic to '' | Add conjunction list evaluation logic to '' | ||
Line 272: | Line 273: | ||
Then add the disjunction list logic right below that: | Then add the disjunction list logic right below that: | ||
- | <code java [highlight_lines_extra=" | + | <code java [highlight_lines_extra=" |
return true; | return true; | ||
case OR: | case OR: | ||
+ | boolean result = false; | ||
for (Expr disjunct : expr.parameters) { | for (Expr disjunct : expr.parameters) { | ||
- | Object | + | Object |
- | checkBooleanOperand(expr.operator, | + | checkBooleanOperand(expr.operator, |
- | | + | |
} | } | ||
- | return | + | return |
default: | default: | ||
// Unreachable. | // Unreachable. |