Decision tables: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: use v5.36) |
(Added Quackery.) |
||
Line 2,180: | Line 2,180: | ||
Try this: |
Try this: |
||
Pray!</pre> |
Pray!</pre> |
||
=={{header|Quackery}}== |
|||
<syntaxhighlight lang="Quackery"> [ say "Check power cable." cr ] is cpc ( --> ) |
|||
[ say "Check printer-computer cable." cr ] is cpcc ( --> ) |
|||
[ say "Ensure printer software installed." cr ] is epsi ( --> ) |
|||
[ say "Check/replace ink." cr ] is cri ( --> ) |
|||
[ say "Check for paper jam." cr ] is cpj ( --> ) |
|||
[ say "No problem detected." cr ] is npd ( --> ) |
|||
[ [ dup $ " (y/n) " join input |
|||
dup $ "" = iff drop again ] |
|||
nip 0 peek upper char Y = ] is condition ( $ --> b ) |
|||
[ $ "Does the printer print?" |
|||
condition |
|||
$ "Is a red light flashing?" |
|||
condition |
|||
$ "Does the computer recognise the printer?" |
|||
condition |
|||
1 << | 1 << | |
|||
[ table |
|||
[ cpc cpcc epsi ] |
|||
[ epsi ] |
|||
[ cpcc epsi cpj ] |
|||
[ epsi ] |
|||
[ cpj ] |
|||
[ npd ] |
|||
[ cri cpj ] |
|||
[ cri ] ] |
|||
cr do ] is diagnose ( --> )</syntaxhighlight> |
|||
{{out}} |
|||
As a dialogue in the Quackery shell. |
|||
<pre>/O> diagnose |
|||
... |
|||
Does the printer print? (y/n) n |
|||
Is a red light flashing? (y/n) n |
|||
Does the computer recognise the printer? (y/n) y |
|||
Check for paper jam. |
|||
</pre> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |