<div dir="ltr"><div style>Clearly, there could be more features and it could be more efficient, but in terms of producing the simplest thing that works for me, I'm really happy with this:</div><div style><br></div><a href="https://gist.github.com/eraserhd/5435505">https://gist.github.com/eraserhd/5435505</a><br>
<div><br></div><div style>Usage:</div><div style><br></div><div style>(define-generic (length object))</div><div style><br></div><div style>(add-method (length (vector? v))</div><div style>  (vector-length s))</div><div style>
(add-method (length (string? s))</div><div style>  (string-length s))</div><div style>(add-method (length (list? l))</div><div style>  (##length l))</div><div style><br></div><div style>(length "hello") => 5</div>
<div style>(length '(1 2 3)) => 3</div><div style>(length '#(a b)) => 2</div><div style><br></div></div>