Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
38
Task/Amb/ALGOL-68/amb.alg
Normal file
38
Task/Amb/ALGOL-68/amb.alg
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
MODE PAGE = FLEX[0]STRING;
|
||||
MODE YIELDPAGE = PROC(PAGE)VOID;
|
||||
MODE ITERPAGE = PROC(YIELDPAGE)VOID;
|
||||
|
||||
OP INITITERPAGE = (PAGE self)ITERPAGE:
|
||||
(YIELDPAGE yield)VOID: # scope violation #
|
||||
FOR i TO UPB self DO
|
||||
yield(self[i])
|
||||
OD;
|
||||
|
||||
OP + = (ITERPAGE for strings, PAGE b)ITERPAGE:
|
||||
(YIELDPAGE yield)VOID: # scope violation #
|
||||
for strings((PAGE amb)VOID:(
|
||||
[UPB amb + 1]STRING joined;
|
||||
joined[:UPB amb] := amb;
|
||||
STRING last string := amb[UPB amb];
|
||||
CHAR last char := last string[UPB last string];
|
||||
FOR i TO UPB b DO
|
||||
IF last char = b[i][1] THEN
|
||||
joined[UPB joined] := b[i];
|
||||
yield(joined)
|
||||
FI
|
||||
OD
|
||||
));
|
||||
|
||||
OP + = (PAGE a, PAGE b)ITERPAGE: INITITERPAGE a + b;
|
||||
|
||||
ITERPAGE gen amb :=
|
||||
PAGE("the", "that", "a") +
|
||||
PAGE("frog", "elephant", "thing") +
|
||||
PAGE("walked", "treaded", "grows") +
|
||||
PAGE("slowly", "quickly");
|
||||
|
||||
PAGE sep;
|
||||
#FOR PAGE amb IN # gen amb( # ) DO #
|
||||
## (PAGE amb)VOID:
|
||||
print((amb[1]+" "+amb[2]+" "+amb[3]+" "+amb[4], new line))
|
||||
#OD# )
|
||||
Loading…
Add table
Add a link
Reference in a new issue