RosettaCodeData/Task/Higher-order-functions/Oberon/higher-order-functions.oberon
2023-07-01 13:44:08 -04:00

34 lines
698 B
Text

MODULE HOFuns;
IMPORT
NPCT:Tools,
Out;
TYPE
Formatter = PROCEDURE (s: STRING; len: LONGINT): STRING;
VAR
words: ARRAY 8 OF STRING;
PROCEDURE PrintWords(w: ARRAY OF STRING; format: Formatter);
VAR
i: INTEGER;
BEGIN
i := 0;
WHILE (i < LEN(words)) DO
Out.Object(format(words[i],16));
INC(i)
END;
Out.Ln
END PrintWords;
BEGIN
words[0] := "Al-Andalus";
words[1] := "contributed";
words[2] := "significantly";
words[3] := "to";
words[4] := "the";
words[5] := "field";
words[6] := "of";
words[7] := "medicine";
PrintWords(words,Tools.AdjustLeft);
PrintWords(words,Tools.AdjustCenter);
PrintWords(words,Tools.AdjustRight)
END HOFuns.