My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-rice: rewrite README example to typecheck

The block had a stray [in] after [Bytes.make 1024 '\x00'] and used a
top-level [match] expression. Promote to top-level [let], handle
[decompress] via [let () = match ... with | Ok ...] + assert, switch
[Printf.printf]/[Printf.eprintf] to [assert]/[Fmt.failwith], and add
[fmt] to the mdx libraries.

+9 -9
+8 -8
ocaml-rice/README.md
··· 34 34 ## Usage 35 35 36 36 ```ocaml 37 - (* Configure: 16 samples per block, 16-bit samples *) 37 + (* Configure: 16 samples per block, 16-bit samples. *) 38 38 let cfg = Rice.config ~block_size:16 ~bits_per_sample:16 () 39 39 40 - (* Compress raw sample data *) 41 - let data = Bytes.make 1024 '\x00' in (* 512 x 16-bit samples *) 40 + (* Compress + decompress 512 16-bit samples. *) 41 + let data = Bytes.make 1024 '\x00' 42 42 let compressed = Rice.compress cfg data 43 43 44 - (* Decompress: must specify how many samples to recover *) 45 - match Rice.decompress ~sample_count:512 cfg compressed with 46 - | Ok original -> Printf.printf "recovered %d bytes\n" (Bytes.length original) 47 - | Error msg -> Printf.eprintf "decompression failed: %s\n" msg 44 + let () = 45 + match Rice.decompress ~sample_count:512 cfg compressed with 46 + | Ok original -> assert (Bytes.length original = 1024) 47 + | Error msg -> Fmt.failwith "decompression failed: %s" msg 48 48 49 - (* Use neighborhood predictor for 2D image data *) 49 + (* Use neighborhood predictor for 2D image data. *) 50 50 let cfg_2d = Rice.config_with_predictor Neighborhood cfg 51 51 ``` 52 52
+1 -1
ocaml-rice/dune
··· 4 4 5 5 (mdx 6 6 (files README.md) 7 - (libraries rice)) 7 + (libraries rice fmt))