Determine if a string is collapsible: Difference between revisions
Content added Content deleted
(→{{header|RPL}}: HP-49 version) |
Not a robot (talk | contribs) (Add Refal) |
||
Line 3,312: | Line 3,312: | ||
Length: 1 <<<A>>> |
Length: 1 <<<A>>> |
||
</pre> |
</pre> |
||
=={{header|Refal}}== |
|||
<syntaxhighlight lang="refal">$ENTRY Go { |
|||
, ('') |
|||
('"If I were two-faced, would I be wearing this ' |
|||
'one?" --- Abraham Lincoln ') |
|||
('..11111111111111111111111111111111111111111111' |
|||
'11111111111111111117777888') |
|||
('I never give \'em hell, I just tell the truth, ' |
|||
'and they think it\'s hell. ') |
|||
(' ' |
|||
' --- Harry S Truman '): e.Strings |
|||
= <Each Show e.Strings>; |
|||
}; |
|||
Each { |
|||
s.F = ; |
|||
s.F t.I e.X = <Mu s.F t.I> <Each s.F e.X>; |
|||
}; |
|||
Brackets { |
|||
e.X, <Lenw e.X>: s.L e.X = |
|||
<Prout <Symb s.L> ': <<<' e.X '>>>'>; |
|||
}; |
|||
Show { |
|||
(e.X) = <Brackets e.X> |
|||
<Brackets <Collapse e.X>> |
|||
<Prout>; |
|||
}; |
|||
Collapse { |
|||
= ; |
|||
s.C s.C e.S = <Collapse s.C e.S>; |
|||
s.C e.S = s.C <Collapse e.S>; |
|||
};</syntaxhighlight> |
|||
{{out}} |
|||
<pre>0: <<<>>> |
|||
0: <<<>>> |
|||
72: <<<"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln >>> |
|||
70: <<<"If I were two-faced, would I be wearing this one?" - Abraham Lincoln >>> |
|||
72: <<<..1111111111111111111111111111111111111111111111111111111111111117777888>>> |
|||
4: <<<.178>>> |
|||
72: <<<I never give 'em hell, I just tell the truth, and they think it's hell. >>> |
|||
69: <<<I never give 'em hel, I just tel the truth, and they think it's hel. >>> |
|||
72: <<< --- Harry S Truman >>> |
|||
17: <<< - Hary S Truman >>></pre> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |