Look-and-say sequence: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Changed to Wren S/H |
Not a robot (talk | contribs) Add Refal |
||
Line 4,734: | Line 4,734: | ||
return ! || $ /*return the ! string plus the $ string*/</syntaxhighlight> |
return ! || $ /*return the ! string plus the $ string*/</syntaxhighlight> |
||
{{out|output|text= is identical to the 1<sup>st</sup> REXX version (the simple version).}}<br><br> |
{{out|output|text= is identical to the 1<sup>st</sup> REXX version (the simple version).}}<br><br> |
||
=={{header|Refal}}== |
|||
<syntaxhighlight lang="refal">$ENTRY Go { |
|||
= <Prout <Sequence 10 1>>; |
|||
}; |
|||
Sequence { |
|||
0 e.seq = ; |
|||
s.N e.seq = <Prout e.seq> |
|||
<Sequence <- s.N 1> <LookSay e.seq>>; |
|||
} |
|||
LookSay { |
|||
= ; |
|||
e.1, |
|||
<First <Group e.1> e.1>: (e.group) e.rest, |
|||
<Lenw e.group>: s.num s.item e.discard = |
|||
s.num s.item <LookSay e.rest>; |
|||
} |
|||
Group { |
|||
s.1 s.1 e.rest = <+ 1 <Group s.1 e.rest>>; |
|||
s.1 e.rest = 1; |
|||
};</syntaxhighlight> |
|||
{{out}} |
|||
<pre>1 |
|||
1 1 |
|||
2 1 |
|||
1 2 1 1 |
|||
1 1 1 2 2 1 |
|||
3 1 2 2 1 1 |
|||
1 3 1 1 2 2 2 1 |
|||
1 1 1 3 2 1 3 2 1 1 |
|||
3 1 1 3 1 2 1 1 1 3 1 2 2 1 |
|||
1 3 2 1 1 3 1 1 1 2 3 1 1 3 1 1 2 2 1 1</pre> |
|||
=={{header|Ring}}== |
=={{header|Ring}}== |