XLISP peek

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# peek

Type: | - | function (subr)
Source: | - | xlsys.c

## Syntax

(peek address)
  address - an integer expression
  returns - the value at the specified address as an integer

## Description

The 'peek' function returns the internal memory value at the 'address'. The returned value is an integer.

## Examples

    (setq var 0)                    ; set up VAR with 0
    (address-of var)                ; returns 123224
    (address-of 'var)               ; returns 161922
    (peek (address-of var))         ; returns 83951616
    (peek (1+ (address-of var)))    ; returns 16777216
    (peek (+ 2 (address-of var)))   ; returns 0  <-- value of VAR
    (setq var 14)                   ; change the value to 14
    (peek (+ 2 (address-of var)))   ; returns 14
    (setq var 99)                   ; change the value to 99
    (peek (+ 2 (address-of var)))   ; returns 99

Caution: Be careful when modifying the internal state of XLISP. If you have modified it, it would be a good idea to exit XLISP and re-enter before doing any work you really want to retain.

Caution: It is possible to 'peek' and poke not just XLISP's memory put other parts of your computer's memory. Be very careful when doing this. Also, in some computers, just looking at a memory location can cause things to happen, I/O locations fall in this category.

See the peek function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference