rebolrebol3

What is the number of native! in Rebol3


How do I calculate the number native functions in Rebol3?

(help native! prints native functions in lib but it does not return a block of words.)

UPDATE: I have corrected the question after the error highlighted by @HostileFork.


Solution

  • A catalog of natives (or at least words of their names) is built at boot time:

    >> length? system/catalog/natives
    == 160
    

    There are more definitions in lib than just native routines. Definitions of typesets and other things. But almost every native is accessible through it at startup:

    >> natives: []
    
    >> foreach [word value] lib [if native? :value [append natives word]]
    
    >> length? natives
    == 168
    

    A few of those differences are accounted for by synonyms (Q for QUIT, --- for COMMENT, etc):

    >> difference natives system/catalog/natives
    == [native action q ! min max --- bind? pwd context]
    

    NATIVE and ACTION are special and for whatever reason do not make it into the catalog.

    (Note that in current evolutions of the Ren-C build of Rebol3, there is only one FUNCTION! datatype. So there is no NATIVE? or ACTION? etc. Hence, system/catalog/natives is your only way to find this out.)