tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | README | LICENSE

commit 62afda910c4dc11f6849b106aad1d9e4b94bb115
parent 0931fb866c240464310b859eaad5535175dbaec0
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Wed,  5 Jan 2022 17:58:50 -0800

Simplify doc string look up

Diffstat:
Mtib/doc.tsp | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tib/doc.tsp b/tib/doc.tsp @@ -71,12 +71,10 @@ (unless (procedure? proc) (error 'doc "documentation only exists for procedures")) (def (lookup proc) - (recur f ((docstrs docstr-reg)) - (cond ((empty? docstrs) - (error 'doc (get proc 'name) ": no documentation found")) - ((= (caar docstrs) (get proc 'name)) - (map println (cdar docstrs))) - (else (f (cdr docstrs)))))) + (let ((docstrs (assoc (get proc 'name) docstr-reg))) + (if docstrs + (map println (cdr docstrs)) + (error 'doc (get proc 'name) ": no documentation found") ))) (if (or (function? proc) (macro? proc)) (let ((docstr (car (get proc 'body)))) (println (cons (get proc 'name) (get proc 'args)))