package quick_print

  1. Overview
  2. Docs
Quick and easy printing for lists, arrays, etc

Install

Dune Dependency

Authors

Maintainers

Sources

0.12.tar.gz
md5=e6d2e0d5d4e217a6fd46f06cd64d2177
sha512=f2d70d76969f286fc55d01750c658db0288e094a63a64c89a9f31663e63a288361ed9a2f480928b65092e89858b66249b242cbbf53bc76b2f9bba09646af2722

Description

Allows quick printing for lists, arrays, Hashtables etc. Useful for learning/ quick debugging

Tags

printing, arrays, lists

Published: 08 Oct 2023

README

quick_print

quick_print is an OCaml library that allows quick and easy pretty-printing of lists, arrays, Hashtables and more. Its main goal is to simplify data visualization during learning and debugging.

Installation

Install quick_print with OPAM:

opam install quick_print

Usage

Quick_print.x where x = the type of data structure, currently simple lists/arrays and many hashtables are supported.
Optional (prefix) prints same line before data structure.
Optional (precision) on float data types gives decimal precision.
ex: 1.2345 with ~precision:1 -> 1.2, ~precision:2 -> 1.23 etc. defaults to 2.

Quick_print.strings_list ~prefix:"string_list: "
[ "hello"; "world"; "my"; "name"; "is" ]; (* output: string_list: [hello; world; my; name; is] *)

let ht = Hashtbl.create 3 in
Hashtbl.add ht 1 [1.1234; 2.1235; 3.23456];
Hashtbl.add ht 2 [4.98765; 5.87654; 6.76543];
Hashtbl.add ht 3 [7.1; 8.01; 9.001];
Quick_print.hashtable_int_float_list ~prefix:"MyHashTable: " ~precision:2 ht
(* output: MyHashTable: {(1, [1.12; 2.12; 3.23]); (2, [4.99; 5.88; 6.77]); (3, [7.10; 8.01; 9.00]); } *)

Contribute

Contributions to quick_print are welcome. Feel free to submit issues and pull requests.

License

This project is licensed under the terms of the MIT license. For more details, see the LICENSE file.

Dependencies (2)

  1. dune >= "3.10"
  2. ocaml >= "4.02"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None