Abbreviations, easy: Difference between revisions
Content added Content deleted
No edit summary |
(→{{header|Picat}}: Adding Picat) |
||
Line 2,807: | Line 2,807: | ||
<pre>user words: riG rePEAT copies put mo rest types fup. 6 poweRin |
<pre>user words: riG rePEAT copies put mo rest types fup. 6 poweRin |
||
full words: RIGHT REPEAT *error* PUT MOVE RESTORE *error* *error* *error* POWERINPUT</pre> |
full words: RIGHT REPEAT *error* PUT MOVE RESTORE *error* *error* *error* POWERINPUT</pre> |
||
=={{header|Picat}}== |
|||
{{trans|Prolog}} |
|||
{{works with|Picat}} |
|||
<lang Picat> |
|||
import util. |
|||
command_table("Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy |
|||
COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find |
|||
NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput |
|||
Join SPlit SPLTJOIN LOAD Locate CLocate LOWercase UPPercase LPrefix MACRO |
|||
MErge MODify MOve MSG Next Overlay PARSE PREServe PURge PUT PUTD Query QUIT |
|||
READ RECover REFRESH RENum REPeat Replace CReplace RESet RESTore RGTLEFT |
|||
RIght LEft SAVE SET SHift SI SORT SOS STAck STATus TOP TRAnsfer Type Up"). |
|||
validate("", _, Result) ?=> |
|||
Result = "". |
|||
validate(Word, Commands, Result), Word \= "" ?=> |
|||
member(Command, Commands), |
|||
append(Prefix, Suffix, Command), |
|||
Prefix == to_uppercase(Prefix), |
|||
Suffix == to_lowercase(Suffix), |
|||
LowWord = to_lowercase(Word), |
|||
LowPrefix = to_lowercase(Prefix), |
|||
append(LowPrefix, Other, LowWord), |
|||
LowCommand = to_lowercase(Command), |
|||
append(LowWord, _, LowCommand), |
|||
Result = to_uppercase(Command). |
|||
validate(Word, _, Result), Word \= "" => |
|||
Result = "*error*". |
|||
main(Args) => |
|||
command_table(Table), |
|||
Commands = split(Table), |
|||
foreach (Word in Args) |
|||
validate(Word, Commands, Result), |
|||
printf("%w ", Result) |
|||
end, |
|||
nl. |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
RIGHT REPEAT *error* PUT MOVE RESTORE *error* *error* *error* POWERINPUT |
|||
</pre> |
|||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |