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

floor

21 views
Skip to first unread message

Slapstiq

unread,
Feb 16, 2000, 3:00:00 AM2/16/00
to
I need to use the floor function but it returns two numbers. Is there any
for me to break a list in two halves?

Thank you

Slapstiq

Barry Margolin

unread,
Feb 16, 2000, 3:00:00 AM2/16/00
to
In article <RgEq4.1897$W5.8...@typhoon.nyroc.rr.com>,

Slapstiq <slap...@rochester.rr.com> wrote:
>I need to use the floor function but it returns two numbers. Is there any
>for me to break a list in two halves?

It doesn't return a list, it returns two values. If you don't use
multiple-value-bind or multiple-value-list to receive the values, only the
first value (the one you probably care about) will be used. E.g. if you
do:

(+ (floor 10.4) 5)

you'll get 15. The remainder 0.4 will be ignored.

--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Erik Naggum

unread,
Feb 16, 2000, 3:00:00 AM2/16/00
to
* "Slapstiq" <slap...@rochester.rr.com>

| I need to use the floor function but it returns two numbers.

if you are talking about Common Lisp, the two numbers are returned as
multiple values, which means that the primary value is the only value you
will see if you don't do something special to capture the others.

if you are talking about Emacs Lisp, the two numbers are returned as a
list of two values if you use the Common Lisp-like FLOOR* function
because Emacs Lisp can only return one value from any function.

| Is there any for me to break a list in two halves?

consider VALUES-LIST. <grin>

#:Erik

Eugene Zaikonnikov

unread,
Feb 17, 2000, 3:00:00 AM2/17/00
to
In article <RgEq4.1897$W5.8...@typhoon.nyroc.rr.com>,
"Slapstiq" <slap...@rochester.rr.com> wrote:
> I need to use the floor function but it returns two numbers. Is

there any
> for me to break a list in two halves?
>
FLOOR returns not a list, but multiple values. Usually you need not
care about the second value as it will be ignored unless you bind with
something like MULTIPLE-VALUE-BIND. If you like, you may explicitly
suppress the second value by writing (VALUES (FLOOR X Y)).

--
Eugene.


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages