Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other

Alphabetic catalog of Language elements A

abs

abs computes the absolute value of a number.

Category Library procedure
Format (abs num)
Parameters
numa number
Description abs computes the absolute value of num. The type of the result is the same as the argument's, with the exception of -16384, as it is not representable as an integer and therefore coerced to a float.
R4RS Compliance Full
Examples
(abs 3.4567) => 3.4567
(abs -4711) => 4711

acos

acos computes the arc cosine of a number.

Category Primitive procedure (MathLib required)
Format (acos z)
Parameters
zany number
Description acos computes the arc cosine of z in radians.

For complex arguments z = x + yi, the formula

acos z = -i ln(z + i sqrt(1-z2))
is used.
R4RS Compliance Full
Examples
(acos 0) => 1.57079632679489
(acos -1) => 3.14159265358979
(acos 1.1) => +0.443568254385115i
(acos 0.5+2i) => 1.34977769117201-1.46571535194729i

acosh

acosh computes the hyperbolic arc cosine of a number.

Category Primitive procedure (MathLib required)
Format (acosh z)
Parameters
zany number
Description acosh computes the hyperbolic arc cosine of z.

For complex arguments z = x + yi, the formula

acosh z = ln(z + i sqrt(1-z2))
is used.
R4RS Compliance LispMe extension
Examples
(acosh 0) => +1.57079632679489i
(acosh 1) => 0
(acosh 3) => 1.76274717403908
(acosh 0.5+2i) => 1.46571535194729+1.34977769117201i

and

and is the non-strict logical conjunction of expressions.

Category Special form
Format (and expr1 ...)
Parameters
expri any expression.
Description and evaluates the expri in left to right order. If any expression is false, the evaluation is finished. In any case, the value of the last expression evaluated is returned. Remember that '() is considered true in LispMe.
R4RS Compliance Full
Examples
(and 4 5) => 5
(and 'a "foo" #f 5) => #f
(and) => #t

angle

angle computes angle (or argument) of a complex number.

Category Native procedure (MathLib required)
Format (angle z)
Parameters
zany number
Description angle computes the angle of the number z. The angle is always in the range -pi (exclusive) and pi (inclusive). See also atan.
R4RS Compliance Full
Examples
(angle 5) => 0
(angle -1) => 3.14159265358979
(angle 0.5+2i) => 1.32581766366803

append

append concatenates lists.

Category Primitive procedure
Format (append listi ...)
Parameters
listia proper list
Description append creates a list consisting of all the elements of the listi in the order of the arguments. The original lists are not modified, but the last list is not copied and shares structure with the result.
R4RS Compliance Full
Examples
(append '(a b) '(c d)) => (a b c d)
(append '(x y z) '() '(1 2 (5)) '("foo")) => (x y z 1 2 (5) "foo")
(append '(x y z) '()) => (x y z) (use this idiom to copy a list)
(append) => ()

apply

apply applies a procedure to arguments given as a list.

Category Primitive procedure
Format (apply procedure arglist)
Parameters
procedurea procedure
arglista proper list
Description apply calls procedure passing each element in arglist to procedure. The result of calling procedure is returned.

apply is especially useful when dealing with procedures with variable length argument lists, see examples.

R4RS Compliance Full
Examples
(define (sum . s)
  (if (null? s)
      0
      (+ (car s)
         (apply sum (cdr s)))))
(sum 1 2 3 4)
=> 10

asin

asin computes the arc sine of a number.

Category Primitive procedure (MathLib required)
Format (asin z)
Parameters
zany number
Description asin computes the arc sine of z in radians.

For complex arguments z = x + yi, the formula

asin z = -i ln(iz + sqrt(1-z2))
is used.
R4RS Compliance Full
Examples
(asin 0) => 0
(asin 1) => 1.57079632679489
(asin 1.1) => 1.57079632679489-0.443568254385115i
(asin 0.5+2i) => 0.221018635622883+1.46571535194729i

asinh

asinh computes the hyperbolic arc sine of a number.

Category Primitive procedure (MathLib required)
Format (asinh z)
Parameters
zany number
Description asinh computes the hyperbolic arc sine of z.

For complex arguments z = x + yi, the formula

asinh z = -ln(sqrt(1+z2) - z)
is used.
R4RS Compliance LispMe extension
Examples
(asinh 0) => 0
(asinh 1) => 0.881373587019543
(asinh 0.5+2i) => 1.36180090085784+1.29304207023718i

assoc assq assv

assoc, assq, and assv search lists containing key/value pairs.

Category Native procedures
Formats
(assoc obj alist)
(assq obj alist)
(assv obj alist)
Parameters
objany object
alistan association list where each element is a pair
Description These procedures return the first element in alist, whose car is obj. If none is found, #f is returned. To compare obj with the keys, assoc uses equal?, assq uses eq?, and assv uses eqv?.
R4RS Compliance Full
Examples
(assoc 'b '((a 1) (b 2))) => (b 2)
(assoc 'c '((a 1) (b 2))) => #f
(assq '(b) '(((a) 1) ((b) 2))) => #f
(assoc '(b) '(((a) 1) ((b) 2))) => ((b) 2)

atan

atan computes the arc tangent of its argument(s).

Category Primitive procedure (MathLib required)
Format
(atan z)
(atan y x)
Parameters
zany number
xa real number
ya real number
Description atan computes the arc tangent of z in radians.

For complex arguments z = x + yi, the formula

atan z = 0.5i ln((i + z) / (i - z))
is used.

With the second form, the result is an angle whose tangent is y/x, but the signs of the arguments decide which of the two angles differing by pi is returned. It's the same value as (angle (make-rectangular x y))

R4RS Compliance Full
Examples
(atan 1) => 0.785398163397448
(atan -1 0) => -1.57079632679489
(atan 0 -1) => 3.14159265358979
(atan 0.5+2i) => 1.4215468610018+0.500370000052531i

atanh

atanh computes the hyperbolic arc tangent of a number.

Category Primitive procedure (MathLib required)
Format (atanh z)
Parameters
zany number
Description atanh computes the hyperbolic arc tangent of z.

For complex arguments z = x + yi, the formula

atanh z = 0.5 ln((1 + z) / (1 - z))
is used.
R4RS Compliance LispMe extension
Examples
(atanh 0.5) => 0.549306144334055
(atanh -1) => [-inf]
(atanh 0.5+2i) => 0.0964156202029962+1.12655644083482i

Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other