RosettaCodeData/Task/Run-length-encoding/Zkl/run-length-encoding-2.zkl

7 lines
230 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
fcn inflate(data){ //-->String
data.howza(3).pump(String,
fcn(c){ // if c==1, read n,c2 and expand, else write c
if(c=="\x01") return(Void.Read,2) else return(Void.Write,c) },
fcn(_,n,c){ c*n.toAsc() })
}