27 lines
575 B
Text
27 lines
575 B
Text
class MAIN is
|
|
look_and_say!: STR is
|
|
current ::= "1";
|
|
loop
|
|
yield current;
|
|
buf ::= #FSTR;
|
|
last ::= current[0];
|
|
count ::= 0;
|
|
loop
|
|
ch ::= current.elt!;
|
|
if ch /= last then
|
|
buf := buf + count + last;
|
|
last := ch; count := 1;
|
|
else
|
|
count := count + 1;
|
|
end;
|
|
end;
|
|
current := (buf + count + last).str;
|
|
end;
|
|
end;
|
|
|
|
main is
|
|
loop 12.times!;
|
|
#OUT+ look_and_say! + "\n";
|
|
end;
|
|
end;
|
|
end;
|