Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how lisp define the function "plus" ?

3 views
Skip to first unread message

attonie

unread,
Feb 22, 2002, 4:46:18 AM2/22/02
to
i`m a lisp newbie, just think about the idear of lisp, puzzled at the
define of base function, so please tell me how the "plus" defined in
lisp? thanks

Kent M Pitman

unread,
Feb 22, 2002, 6:00:01 AM2/22/02
to
att...@etang.com (attonie) writes:

> i`m a lisp newbie,

Welcome!

> just think about the idear of lisp, puzzled at the define of base
> function, so please tell me how the "plus" defined in lisp? thanks

Perhaps you're looking for + ?

It's already there. You just use it.

(+ 1 2)
=> 3

Or maybe you're asking how you would define PLUS given +? I guess
if you wanted just a two-argument version you'd do:

(defun plus (x y)
(+ x y))

or if you wanted a multi-argument version you'd do:

(defun plus (&rest arguments)
(apply #'+ arguments))

If you're asking how pre-defined functions get there in the first place,
the best way to model it is this: They are given by God.

attonie

unread,
Feb 24, 2002, 2:22:10 AM2/24/02
to
Kent M Pitman <pit...@world.std.com> wrote in message news:<sfwg03t...@shell01.TheWorld.com>...

yeah, i`m looking for pre-defined functions, did you know how many
pre-defined functions the lisp get from God, and what are thoes ? the
core is that i use what and how many Base-functions can deduce the
"real-world".

Kent M Pitman

unread,
Feb 24, 2002, 4:29:30 AM2/24/02
to
att...@etang.com (attonie) writes:

> yeah, i`m looking for pre-defined functions, did you know how many
> pre-defined functions the lisp get from God, and what are thoes ? the
> core is that i use what and how many Base-functions can deduce the
> "real-world".

Common Lisp has 978 pre-defined names, some of which are functions, some are
variables, and some have other semantic properties.

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/01_i.htm

0 new messages