This page contains the description of the following commands variablep, vect_to_number, vector, vectorp, version, vlength, vref, vset,
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) ()
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
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]
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)]
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
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
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
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] #[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[#[...
back to home page
© INRIA 2005, 2006
Last modified $Date: 2009/01/08 17:43:30 $