RosettaCodeData/Task/Extend-your-language/Lambdatalk/extend-your-language.lambdatalk
2023-07-01 13:44:08 -04:00

18 lines
592 B
Text

{macro \{if2 (true|false|\{[^{}]*\}) (true|false|\{[^{}]*\})\}
to {if {and $1 $2}
then both are true
else {if {and $1 {not $2}}
then the first is true
else {if {and {not $1} $2}
then the second is true
else neither are true}}}}
{if2 true true} -> both are true
{if2 true false} -> the first is true
{if2 false true} -> the second is true
{if2 false false} -> neither are true
{if2 {< 1 2} {< 3 4}} -> both are true
{if2 {< 1 2} {> 3 4}} -> the first is true
{if2 {> 1 2} {< 3 4}} -> the second is true
{if2 {> 1 2} {> 3 4}} -> neither are true