The Grinnell Scheme Web: Arity and operand
type

It's hard to remember the details of how many operands each of these procedures takes and what kinds of numbers they can be applied to.

Yes, it's kind of a nuisance, but in practice common sense will keep you from running into most of the theoretically possible problems. Here's a summary table that you can copy and consult if you're worried about making a mistake:

procedure     arity          operand types
---------------------------------------------------------------------------
+             0 or more      integers, rationals, reals, or complex numbers
-             1 or 2         integers, rationals, reals, or complex numbers
*             0 or more      integers, rationals, reals, or complex numbers
quotient      2              integers (second operand non-zero)
remainder     2              integers (second operand non-zero)
modulo        2              integers (second operand non-zero)
abs           1              integer, rational, or real
max           1 or more      integers, rationals, or reals
min           1 or more      integers, rationals, or reals
gcd           0 or more      integers
lcm           0 or more      integers
---------------------------------------------------------------------------
A procedure's arity is simply the number of operands to give it.


Next topic
Previous topic
Table of contents


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/scheme-web/arity.html


created June 25, 1995
last revised December 26, 1995

Copyright 1995 by John David Stone (stone@math.grin.edu)