quil/quil — pull request #28 by astanin (2012-07-09 15:27:10+00:00)
Title: show-fns to lookup by function name, compact output

### Lookup by name

I suggest to extend `show-fns` to allow not only lookup by numeric category index, but also by a substring of the category title or the function name. This allows to discover functions across categories, and it is also easier to remember.

For example, to find functions which work with images, the user may type:

```
user=> (show-fns "image")
1.4 Setting
background-image
4 Environment
cursor-image
5 Image
create-image
5.1 Loading & Displaying
image image-mode load-image mask-image request-image
5.2 Pixels
set-image
9.2 Image
save save-frame
```

This output is likely to contain the function the user is looking for, and it also displays related categories for further browsing. Being able to refer to categories by name, the user may often skip `show-cats`. For example, it's difficult to remember that primitives belong categories 11.1 and 11.2, but it is easy to type:

```
user=> (show-fns "primitives")
11.1 2D Primitives
arc ellipse line point quad rect triangle
11.2 3D Primitives
box sphere sphere-detail
```

An alternative to this commit set might be a separate function (e.g. `apropos`), but as old `show-fns` took only numeric arguments, I think it is a good case for overloading.

### Compact output

Old `show-fns` prints one function name per line. This wastes screen spaces, and provokes much more scrolling in REPL history than necessary. As function names are just words, I suggest to print all them in a single line. This commit set takes care of wrapping lines nicely to fit 80 columns.

For example, new `(show-fns 8.1)` prints only 3 lines, and the previous REPL result is likely to remain visible to the user:

```
user=> (show-fns 8.1)
8.1 Calculation
abs abs-float abs-int ceil constrain constrain-float constrain-int dist exp
lerp log mag map-range norm pow round sq sqrt
nil
```

### Printing category IDs

It's important that category names and function names are easily distinguishable in the output. Old output format used indenting and a hyphen prefix for function names. In new output format there may be functions from more than just one category, and hyphens are removed, so there is greater need to distinguish category names.

Function names are distinguished by indentation and lower case. Category names are now distinguished by numerical prefix (_new_), zero indentation and capital letters. Numerical prefix in the category name often helps to avoid `show-cats`.