diff options
| author | mryouse | 2023-06-03 20:22:18 +0000 | 
|---|---|---|
| committer | mryouse | 2023-06-03 20:22:18 +0000 | 
| commit | 7b7bf727da3250907284368b98b0083a4b4e2386 (patch) | |
| tree | 34802caea5181dc0fb97992746ab99b080448418 /p99/p10.neb | |
initial commit
Diffstat (limited to 'p99/p10.neb')
| -rw-r--r-- | p99/p10.neb | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/p99/p10.neb b/p99/p10.neb new file mode 100644 index 0000000..25ea1dc --- /dev/null +++ b/p99/p10.neb @@ -0,0 +1,15 @@ +; P10 Run-length encoding of a list. +; Use the result of problem P09 to implement the so-called run-length +; encoding data compression method. Consecutive duplicates of elements +; are encoded as arrays [N, E] where N is the number of duplicates of the +; element E. + +(use "p09.neb")  ; NOTE: this runs everything at this juncture, not just def/func + +(func encode (lst) +    (map +        (lambda (item) +            (list (length item) (first item))) +        lst)) + +(print (->string (encode (pack-dup a)))) | 
