square(3scm) Scheme Programmer's Manual square(3scm)

square - multiply a number by itself

(import (scheme base))              ;R7RS

(square z)

Returns the square of z. This is equivalent to (* z z).

Returns a single value which is a number.

(square 42)  => 1764
(square 2.0) => 4.0

Only exists in R7RS. Can be replaced with (lambda (z) (* z z)).

It is an error for this procedure to be passed the wrong number of arguments, and it is an error if z is not a complex number object. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

sqrt(3scm), expt(3scm), *(3scm)

R7RS

The square procedure first appears in R7RS.

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2022-04-05