When working with trees and lists :
import * as L from "./utils/list.functional.api.js";
import * as T from "./utils/tree.functional.api.js";
anyToString(3.14); // -> "3.14"
anyToString(L.cons(1, L.cons(2, L.nil))); // -> "(|1, 2|)"
anyToString(T.node(1, L.cons(T.leaf(2), L.nil))); // -> "node(1, (|leaf(2)|))"
Returns a string representing the arguments passed to the function. If more than one argument is given, returns a string representing the array of arguments.
Internally, if an object contains a
toStringFun
key, this function reuses this key to print the object.