angerangel edited this page Jan 7, 2013 · 1 revision

USAGE

   WHAT 'name /args

DESCRIPTION

Prints a list of known functions.

WHAT is a function value.

ARGUMENTS

  • name -- Optional module name (word! lit-word! unset!)

REFINEMENTS

  • /args -- Show arguments not titles

#SOURCE

what: make function! [  [
    "Prints a list of known functions."
    'name [word! lit-word! unset!] "Optional module name"
    /args "Show arguments not titles"
    /local ctx vals arg list size
][
    list: make block! 400
    size: 0
    ctx: any [select system/modules :name lib]
    foreach [word val] ctx [
        if any-function? :val [
            arg: either args [
                arg: words-of :val
                clear find arg /local
                mold arg
            ] [
                title-of :val
            ]
            append list reduce [word arg]
            size: max size length? word
        ]
    ]
    vals: make string! size
    foreach [word arg] sort/skip list 2 [
        append/dup clear vals #" " size
        print [head change vals word any [arg ""] ]
    ]
    exit
] ]
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.