Beginnings of a J addon to provide interactive documentation
Inspiration is from Matlab's help()
function, which returns documentation for things.
e.g. typing into the prompt the phrase: help(serial)
would return something like a UNIX manual page for Matlab's serial
-related functions, directly into the REPL. Matlab's REPL also allows hyperlinking to other documentation, which is a nice feature for newbies, but perhaps not practical for something that runs in the terminal.
Nice-to-have features would be a way to resolve ambiguous queries, in an interactive manner such as:
There are 2 results for 'foobar', did you mean one of these?
1) foobar_jwplot_
2) foobarbaz_jregex_
Type 1 or 2 to view documentation for that name.
Also nice would be if the help
function searched not only the loaded locales, but also the user's ~addons/
folder, or other paths that make sense.
The idea would be that users could add a line to load'jhelp'
to their config file if desired.
Example usage (using jconsole):
help'rx' NB. monadic form, returns nouns, adverbs, conjunctions, and verbs
┌────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│base │ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ctag │ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│j │ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│jadetag │ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│jcompare│ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│jregex │┌───┬─────┬───────┬──────┬─────┬─────┬────┬───────┬───────┬──────┬──────┬─────────┬────┬───────┬──────┬────────┬─────────┬───────┬─────────┬───────┬────┬────┬──────┬──────────┬────────┬──────┬─────┬──────┐│
│ ││rxE│rxall│rxapply│rxcomp│rxcut│rxdll│rxeq│rxerror│rxfirst│rxfree│rxfrom│rxhandles│rxin│rxindex│rxinfo│rxlastrc│rxlastxrp│rxmatch│rxmatches│rxmerge│rxmp│rxms│rxnsub│rxpatterns│rxregxsz│rxrplc│rxszi│rxutf8││
│ │└───┴─────┴───────┴──────┴─────┴─────┴────┴───────┴───────┴──────┴──────┴─────────┴────┴───────┴──────┴────────┴─────────┴───────┴─────────┴───────┴────┴────┴──────┴──────────┴────────┴──────┴─────┴──────┘│
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│jtask │ │
├────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│z │┌─────┬─────┬───┬─────┬───────┬──────┬─────┬────┬───────┬───────┬──────┬──────┬─────────┬────┬───────┬──────┬───────┬─────────┬───────┬──────┬──────┐ │
│ ││cderx│dbrrx│rxE│rxall│rxapply│rxcomp│rxcut│rxeq│rxerror│rxfirst│rxfree│rxfrom│rxhandles│rxin│rxindex│rxinfo│rxmatch│rxmatches│rxmerge│rxrplc│rxutf8│ │
│ │└─────┴─────┴───┴─────┴───────┴──────┴─────┴────┴───────┴───────┴──────┴──────┴─────────┴────┴───────┴──────┴───────┴─────────┴───────┴──────┴──────┘ │
└────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
(noun, adverb) help 'rx' NB. dyad form, filtering all but nouns and adverbs from result
┌────────┬──────────────────────────────────────────────────────────────────────────────┐
│base │ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│ctag │ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│j │ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│jadetag │ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│jcompare│ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│jregex │┌───────┬─────┬────────┬─────────┬───────┬────┬────┬──────────┬────────┬─────┐│
│ ││rxapply│rxdll│rxlastrc│rxlastxrp│rxmerge│rxmp│rxms│rxpatterns│rxregxsz│rxszi││
│ │└───────┴─────┴────────┴─────────┴───────┴────┴────┴──────────┴────────┴─────┘│
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│jtask │ │
├────────┼──────────────────────────────────────────────────────────────────────────────┤
│z │┌───────┬───────┐ │
│ ││rxapply│rxmerge│ │
│ │└───────┴───────┘ │
└────────┴──────────────────────────────────────────────────────────────────────────────┘