All commands, alphabetic order; letter V

This page contains the description of the following commands variablep, vect_to_number, vector, vectorp, version, vlength, vref, vset,


(variablep) (Lisp function)

The variablep function takes one argument. It returns it in case it is a normal variable, it returns () otherwise. It returns () in the case of a variable function or a constant.

[Endymion] (variablep 'foo)
foo
[Endymion] (variablep 'bar)
bar
[Endymion] (variablep 'true)
()
[Endymion] (variablep ())
()
[Endymion] (variablep false)
()
[Endymion] (variablep ibase)
()

(vect_to_number V) (Lisp function)

Assume that V is a vector, with elements x1, x2, ..., xn, where each xi is a small integer; the function returns 0 otherwise. Let B be 232, so that each xi can be considered as a number between 0 and B-1. The function returns the sum of the xi times Bn-i.

[Endymion] (setq x (- (** 2 32) 5) y 12345 z 6789 B (** 2 32))
4294967296
[Endymion] (vect_to_number (vector x y z))
79228162422030670246367468165
[Endymion] (+ (* x B B) (* y B) z)
79228162422030670246367468165

(vector x1 ... xn) (Lisp function)

The vector function takes some arguments, and constructs a vector holding these elements in order,

[Endymion] (vector)
#[]
[Endymion] (vector 1)
#[1]
[Endymion] (vector 1 2 3)
#[1 2 3]

(vectorp x) (Lisp function)

The vectorp function takes one argument. It returns the argument if it is a vector. It returns () otherwise.

[Endymion] (vectorp ())
()
[Endymion] (vectorp '(foo))
()
[Endymion] (vectorp '"(foo)")
()
[Endymion] (vectorp '#[(foo)])
#[(foo)]

(version) (Lisp function)

The version function takes no argument; it returns the current version of Endymion as a string. Example

[Endymion] (version)
0.03
[Endymion] (type-of (version))
string

(vlength vec) (Lisp function)

The vlength function takes as argument a vector, and returns its length. It can signal an error if the argument is not a vector.

[Endymion] (vlength 35)
vlength : not a vector : 35
[Endymion] (vlength #[35])
1
[Endymion] (vlength #[])
0
[Endymion] (vlength #:foo:bar:#[1 2 3])
3

(vref vec ind) (Lisp function)

The vref function takes as argument a vector, and an index, and returns the corresponding position in the vector. Three kinds of error may be signaled: the first argument is not a vector, the second argument is not an integer, the second argument is out of bounds.

[Endymion] (vref #[a b c] 0)
a
[Endymion] (vref #[a b c] 1)
b
[Endymion] (vref #[a b c] 2)
c
[Endymion] (vref #[a b c] 1/2)
vref : not a fixnum : 1/2
[Endymion] (vref #[a b c] 3)
vref : argument out of bounds : 3
[Endymion] (vref #[a b c] -1)
vref : argument out of bounds : -1
[Endymion] (vref 16 1)
vref : not a vector : 16

(vset vec ind val) (Lisp function)

The vset function takes as argument a vector, an index, and a value. The function modifies the value of the vector at the given index, inserting the value, it returns the value. Three kinds of error may be signaled: the first argument is not a vector, the second argument is not an integer, the second argument is out of bounds.

[Endymion] (setq x #[1 2 3 4])
#[1 2 3 4]
[Endymion] (vset x 0 'a)
a
[Endymion] (vset x 1 'b)
b
[Endymion] (vset x 4 'c)
vset : argument out of bounds : 4
[Endymion] (vset x -4 'c)
vset : argument out of bounds : -4
[Endymion] (vset x 1/2 'c)
vset : not a fixnum : 1/2
[Endymion] (vset 1 2 'c)
vset : not a vector : 1
[Endymion] x
#[a b 3 4]
[Endymion] (vset x 0 x)
#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[...
[Endymion] (cirprint x)
#2=#[#2# b 3 4]
#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[...

Valid XHTML 1.0 Strict back to home page © INRIA 2005, 2006 Last modified $Date: 2009/01/08 17:43:30 $