Factorize string into Lyndon words: Difference between revisions

Added Easylang
(→‎{{header|ALGOL 68}}: Fix for cases where LWB s isn't 1)
(Added Easylang)
Line 141:
001
</pre>
 
=={{header|EasyLang}}==
{{trans|Julia}}
<syntaxhighlight>
proc lyndonfact s$ . .
n = len s$
s$[] = strchars s$
i = 1
while i <= n
j = i + 1
k = i
while j <= n and strcode s$[k] <= strcode s$[j]
if strcode s$[k] < strcode s$[j]
k = i
else
k += 1
.
j += 1
.
while i <= k
print substr s$ i j - k
i += j - k
.
.
.
m$ = "0"
for i to 7
for c$ in strchars m$
if c$ = "0"
m$ &= "1"
else
m$ &= "0"
.
.
.
lyndonfact m$
</syntaxhighlight>
 
=={{header|Julia}}==
Line 182 ⟶ 219:
["011", "01", "0011", "00101101", "0010110011010011", "00101100110100101101001100101101", "001011001101001011010011001011001101001100101101", "001011001101", "001"]
</pre>
 
 
=={{header|MATLAB}}==
1,983

edits