HomeContentsContents
frob_class() frob_handler() frob_value() fromliteral()
size() toerr() tofloat() toint()
toliteral() toobjnum() tostr() tosym()
type() valid()

frob_class()

OBJNUM frob_class(FROB frob)

This function returns the class of a frob. See Frob for more details on frobs.


        frob_class(<$list, [1, 2, 3], 'sort>)
            => $list
    
Top

frob_handler()

SYMBOL frob_handler(FROB frob)

This function returns the handler of a frob. See Frob for more details on frobs.


        frob_handler(<$list, [1, 2, 3], 'sort>)
            => 'sort
    
Top

frob_value()

DATA frob_value(FROB frob)

This function returns the value of a frob. See Frob for more details on frobs.


        frob_value(<$list, [1, 2, 3], 'sort>)
            => [1, 2, 3]
    
Top

fromliteral()

ANY fromliteral(STRING data)

This function takes the literal representation of the data given in the string argument data and parses it to actual data, returning the result. If it cannot parse the data, the error ~type is thrown.


        fromliteral("[1, 'foo]")
            => [1, 'foo]
    
Top

size()

INTEGER size([ANY data])

This function is used for sizing data. If no arguments are specified, it will return the size of the current object, including all of the methods and object variable instances defined on it. Otherwise it returns the size of the first argument. Note: specifying an objnum as the argument will return the size of the objnum, not the size of the object it represents.

The number returned represents the size, in bytes, on disk. Because data is packed when written to the disk database, what is returned will not be comparable to runtime memory footprints.


        size(#1234)
            => 4

        size([1, 2, 3, 4])
            => 15

        size(#[['key1, 1], ['key2, "test"]])
            => 45

        size(<$root, #[['name, "foo"]]>);
            => 37

        size()
            => 5822
    
Top

toerr()

ERROR toerr(SYMBOL errname)

This function converts the argument specified by errname to an error code.


        toerr('perm)
            => ~perm
    
Top

tofloat()

FLOAT tofloat(STRING|INTEGER|OBJNUM data)

This function accepts a string, integer or objnum data type and converts it to a float data type. Specifying any other data type will result in a ~type error.


        tofloat(42) | tofloat("42") | tofloat(#42)
            => 42.0
    
Top

toint()

INTEGER toint(FLOAT|STRING|OBJNUM data)

This function accepts a float, string or objnum data type and converts it to an integer data type. Specifying any other data type will result in a ~type error.


        toint(42.0) | toint("42") | toint(#42)
            => 42
    
Top

toliteral()

STRING toliteral(ANY data)

This function converts any data to a literal representation of itself, which, if recompiled, would result in the same data.


        toliteral([1, 'foo])
            => "[1, 'foo]
    
Top

toobjnum()

OBJNUM toobjnum(INTEGER number)

This function converts the integer data type specified by number to an objnum data type. The returned objnum may or may not point to a valid object.


        toobjnum(1)
            => $root
    
Top

tostr()

STRING tostr(ANY data)

This function returns a simple representation of the data specified by data. It does not return a literal representation, as toliteral() does, but instead is more succinct. For instance, with complex data types such as lists, the returned representation is simply "[list]". Less complex data types such as integers will still return the correct literal value.


        tostr(1)
            => "1"

        tostr(#1)
            => "$root"

        tostr([1, 'foo])
            => "[list]"
    
Top

tosym()

SYMBOL tosym(STRING input)

This function creates a symbol from the string input. Symbols can only contain alphanumeric characters and the underscore character. If a string is specified with characters other than these, the error ~symbol is thrown.


        tosym("foo")
            => 'foo
    
Top

type()

SYMBOL type(ANY data)

This function returns a symbol name for the data type of data. The following symbols represent the respective types:

BUFFER'buffer
DICTIONARY'dictionary
ERROR'error
FLOAT'float
FROB'frob
INTEGER'integer
LIST'list
OBJNUM'objnum
STRING'string
SYMBOL'symbol

More information can be found in the section on Data Types.


        type(42)
            => 'integer
    
Top

valid()

INTEGER valid(OBJNUM objnum)

This function returns 1 (true) if the object pointed to by objnum exists, or 0 (false) if it does not.


        valid($root)
            => 1
    
Top

Contents Previous Next Index

Valid XHTML 1.0 Strict