hellerve / sbcli

A REPL for my SBCL needs
GNU General Public License v3.0
94 stars 13 forks source link

:doc of a function: print its argument list #11

Closed vindarel closed 4 years ago

vindarel commented 4 years ago

Hello,

I figured it is useful to see the actual parameters of the function we are getting the documentation of.

> :doc parse-integer
FUNCTION: Examine the substring of string delimited by start and end
  (default to the beginning and end of the string)  It skips over
  whitespace characters and then tries to parse an integer. The
  radix parameter must be between 2 and 36.
ARGLIST: (STRING &KEY (START 0) END (RADIX 10) JUNK-ALLOWED)

I use a portable library. Under SBCL, it is

    (sb-introspect:function-lambda-list function)

Note: on my side I downcased the arglist with this, but there's certainly a format solution:

    do (format t "ARGLIST: ~a~&" (str:downcase (str:unwords (arglist sym)))))
hellerve commented 4 years ago

I think a portable solution is fine, but this REPL is only designed to work with SBCL anyway, so I’m not sure if we should add another dependency in the name of portability. Do you have thoughts on this?

vindarel commented 4 years ago

I agree. I'll fix this, though suddenly my Package SB-INTROSPECT does not exist, even though it worked once and trivial-arguments works O_o

hellerve commented 4 years ago

That’s a fun problem! Do let me know what comes of it!

vindarel commented 4 years ago

I sent the change even though I still have the fun problem.

hellerve commented 4 years ago

I can reproduce this error. (require :sb-introspect) makes it disappear, though.

vindarel commented 4 years ago

TIL, thanks. (commited)

hellerve commented 4 years ago

Thank you again!