|Prompted by the side note at http://arclanguage.org/item?id=12256, here's a fun toy I whipped up to solve the problem of overly-long REPL output.|
Not very useful, but I thought I'd share it anyway.
(def terse-repl ((o limit 80))
(prn "Use (verbose-repl) to turn off ellipsized output.")
(disp "arc> ")
(on-err [do (disp "Error: ") (write (details _)) (prn)]
(let expr (read)
(if (is expr ':a)
(iso expr '(verbose-repl))
(do (prn "Turning off ellipsized output.")
(let val (eval expr)
(prn (ellipsize (tostring (write val)) limit))
(= that val thatexpr expr)))))))))
Use (verbose-repl) to turn off ellipsized output.
arc> (= x (n-of 1000000 (rand)))
(0.9777547694679798 0.07493917168754799 0.13700886175451876 0.6612940629825846 0...
Turning off ellipsized output.
arc> (len x)