Rebol Programming/what

From Wikibooks, open books for an open world
< Rebol Programming
Jump to navigation Jump to search

USAGE:[edit | edit source]

WHAT 

DESCRIPTION:[edit | edit source]

Prints a list of globally-defined functions.

WHAT is a function value.

SOURCE CODE[edit | edit source]

what: func [
    "Prints a list of globally-defined functions." 
    /local vals args here total
][
    total: copy [] 
    vals: second system/words 
    foreach word first system/words [
        if any-function? first vals [
            args: first first vals 
            if here: find args /local [args: copy/part args here] 
            append total reduce [word mold args]
        ] 
        vals: next vals
    ] 
    foreach [word args] sort/skip total 2 [print [word args]] 
    exit
]