Run-length encoding: Difference between revisions

Added K Version
(Added K Version)
Line 1,237:
return output;
}</lang>
 
=={{header|K}}==
 
 
<lang k>rle: {,/($-':i,#x),'x@i:&1,~=':x}</lang>
 
{{trans|J}}
 
<lang k>rld: {d:"0123456789"; ,/(.(d," ")@d?/:x)#'x _dvl d}</lang>
 
'''Example:'''
 
<lang k> rle "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW"
"12W1B12W3B24W1B14W"
rld "12W1B12W3B24W1B14W"
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW"</lang>
 
=={{header|Liberty BASIC}}==