17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

435 rem<br />

is empty and no :initial-value is specified, then function is called with zero<br />

arguments, and reduce returns whatever the function returns. (This is the<br />

only case where function is called with other than two arguments.)<br />

sequence can be either a list or a vector (one-dimensional array). Note that<br />

nil is considered to be a sequence, of length zero.<br />

For example:<br />

(reduce #'+ '(1 2 3 4» => 19<br />

(reduce #'- '(1 234) :fram-end t) => -2<br />

(reduce #'+ '(» => 9<br />

(reduce #'+ #(1 1 1 1 1) :start 2 :end 5) => 3<br />

(reduce #'list '(1 2 3 4» => «(1 2) 3) 4)<br />

(reduce #'list '(1 234) :initial-value 'faa :fram-end t) =><br />

(1 (2 (3 (4 FDD»»<br />

For a table of related items: See the section "Mapping Sequences" in Symbolics<br />

Common Lisp: Language Concepts.<br />

•<br />

rem number divisor Function<br />

rem divides number by divisor, truncating the quotient toward zero, and<br />

returns the remainder. This is the same as the second value of (truncate<br />

number divisor). If q and r denote, respectively, the quotient and<br />

remainder, then: q III divisor + r = number.<br />

The arguments can be rational or floating-point numbers. The returned<br />

value, r is rational if both arguments are rational; it is floating-point if either<br />

argument is floating-point.<br />

Examples:<br />

(rem 3 2) => 1<br />

(rem 3 -2) => 1<br />

(rem -3 2) => -1<br />

(rem -3 -2) => -1<br />

(rem 4 2) => 9<br />

(rem 3.8 2) => 1.8<br />

(rem -3.8 2) => -1.8<br />

(rem 19/5 2) => 9/5<br />

The following functions are synonyms of rem:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!