Built-in help text (not html) documentation for Racket xrepl

Im working racket

as repl (with xrepl ) and Im able to use ,doc

to see the related documentation (almost awesome), but it launches a web browser to view the documentation. Id like to be able to see documents directly in repl, similar to how it is presented in other answers (R, Clojure, ipython, pry, etc.). Is it possible?

For example, in Clojure s lein repl

you can do:

user=> (doc map)
-------------------------
clojure.core/map
([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
  Returns a lazy sequence consisting of the result of applying ...

      

It would be great to see the source ( (source map)

in clojure), but I haven't seen any hints of its availability.

I'm using Vim (with slime / tmux), so any Vim based solution will work as well, possibly tied to its inline help K.

+3


source to share


2 answers


I put together VROD , a solution that parses help documentation into something that Vim can work with. This provides, in essence, what you can get from clojure's built-in help doc

, but via Vims K

-help. And also some examples and examples.



(Automatic completion of functions also occurs.)

0


source


I'm not sure if this is practical given the nature of Racket's documentation.

  • Help availability is HTML.

  • Unlike Clojure (or Emacs Lisp), Racket has no doc lines in the source of the function definition.

  • There is no such convention in the Racket docs that the first line of the doc line should be a summary (short version for use in situations like a command list or REPL).

You can try the xrepl command ,desc <id>

. As of Racket 6.1.1 , if a function has the documentation installed, it will print a blue square rendering - the signature of the function with contracts and / or types.In many cases, all you need to do is tell it to run through memory. However, there is no text describing the item. And if there is no installed help for the function, it won't try to show you anything based on the source of the function definition.



So, for example, in racket mode for Emacs there is a command racket-describe

and it doesn't start the browser, but it shows the complete HTML help (if any) with a help shr

in a separate Emacs buffer.If there is no help, it tries to find the source and extract the contract / type and a signature to show you. But then again, this source does not have a doc line to find, much less a one-line summary to show the REPL clearly.


There are vim fans using Racket; those I know use Emacs' evil mode and consider it the best of both worlds. However, I appreciate not your current workflow using multiple languages, so I am not suggesting this as a solution for you.

+1


source







All Articles