Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Run-length-encoding/PicoLisp/run-length-encoding.l
Normal file
23
Task/Run-length-encoding/PicoLisp/run-length-encoding.l
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
(de encode (Str)
|
||||
(pack
|
||||
(make
|
||||
(for (Lst (chop Str) Lst)
|
||||
(let (N 1 C)
|
||||
(while (= (setq C (pop 'Lst)) (car Lst))
|
||||
(inc 'N) )
|
||||
(link N C) ) ) ) ) )
|
||||
|
||||
(de decode (Str)
|
||||
(pack
|
||||
(make
|
||||
(let N 0
|
||||
(for C (chop Str)
|
||||
(if (>= "9" C "0")
|
||||
(setq N (+ (format C) (* 10 N)))
|
||||
(do N (link C))
|
||||
(zero N) ) ) ) ) ) )
|
||||
|
||||
(and
|
||||
(prinl "Data: " "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW")
|
||||
(prinl "Encoded: " (encode @))
|
||||
(prinl "Decoded: " (decode @)) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue