On this page:
3.1 Type Instances
undefined
null
3.2 Additional Type Utilities
3.2.1 Type Predicates
defined?
undefined?
null?
boolean?
number?
string?
primitive-value?
object?
3.2.2 Reference Type
reference
3.2.3 Type Conversions
to-primitive
to-boolean
to-number
to-integer
to-int32
to-uint32
to-uint16
to-string
to-object
6.3.90.900

3 Types

3.1 Type Instances

The undefined value.

value

null : null?

The null value.

3.2 Additional Type Utilities

 (require ecmascript/types) package: ecmascript

3.2.1 Type Predicates

procedure

(defined? v)  boolean?

  v : any/c
Returns #f if v is the undefined value, #t otherwise.

procedure

(undefined? v)  boolean?

  v : any/c
Returns #t if v is the undefined value, #f otherwise.

procedure

(null? v)  boolean?

  v : any/c
Returns #t if v is the null value, #f otherwise.

procedure

(boolean? v)  boolean?

  v : any/c
Returns #t if v is a boolean value, #f otherwise.

procedure

(number? v)  boolean?

  v : any/c
Returns #t if v is a number, #f otherwise.

procedure

(string? v)  boolean?

  v : any/c
Returns #t if v is a string, #f otherwise.

procedure

(primitive-value? v)  boolean?

  v : any/c
Returns #t if v is the undefined value, the null value, a boolean, a number or a string.

procedure

(object? v)  boolean?

  v : any/c
Returns #t if v is an ECMAScript object, #f otherwise.

3.2.2 Reference Type

struct

(struct reference (base name strict?)
    #:extra-constructor-name make-reference)
  base : (or/c object? (is-a?/c environment-record%) undefined?)
  name : string?
  strict? : boolean?
An ECMAScript reference.

3.2.3 Type Conversions

 (require ecmascript/convert) package: ecmascript

procedure

(to-primitive v [preferred])  primitive-value?

  v : value?
  preferred : (or/c 'number 'string #f) = #f
Converts v to a primitive value. If preferred is 'number or 'string, the conversion process may return a value of that type. If v is already a primitive value, it is returned unchanged.

procedure

(to-boolean v)  boolean?

  v : value?
Converts v to a boolean value.

procedure

(to-number v)  number?

  v : value?
Converts v to a number (possibly +nan.0).

procedure

(to-integer v)  number?

  v : value?
Converts v to a number and returns the result of truncating it to an integer.

procedure

(to-int32 v)  number?

  v : value?
Converts v to a signed 32-bit integer.

procedure

(to-uint32 v)  number?

  v : value?
Converts v to an unsigned 32-bit integer.

procedure

(to-uint16 v)  number?

  v : value?
Converts v to an unsigned 16-bit integer.

procedure

(to-string v)  string?

  v : value?
Returns a string representation of v.

procedure

(to-object v)  object?

  v : (and/c value? (not/c undefined?) (not/c null?))
If v is an ECMAScript object, it is returned unchanged. Otherwise, a new Boolean, Number or String object is created with its value set to v.