Rep-string: Difference between revisions

Add APL
m (→‎{{header|Haskell}}: Applied Hlint to first version.)
(Add APL)
Line 210:
00: longest rep string: "0"
1: no rep string</pre>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
This function returns a list of all possible repeated substrings.
It returns the empty list if there are none.
<lang APL>rep ← ⊢ (⊢(/⍨)(⊂⊣)≡¨(≢⊣)⍴¨⊢) ⍳∘(⌊0.5×≢)↑¨⊂</lang>
{{out}}
<pre> rep '1001110011'
10011
rep '1110111011'
1110
rep '0010010010'
001
rep '1010101010'
10 1010
rep '1111111111'
1 11 111 1111 11111
rep '0100101101'
 
rep '0100100'
010
rep '101'
 
rep '11'
1
rep '00'
0
rep ,'1'
 
</pre>
 
 
=={{header|AppleScript}}==
2,124

edits