Subject: Re: Really Dumb Newbie Question
From: Erik Naggum <erik@naggum.net>
Date: Thu, 23 May 2002 21:31:56 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3231178315801215@naggum.net>

* Samantha Skyler
| How do I just get lisp to return the rounded number without all that junk?

  Common Lisp supports multiple return values.  However, only the primary
  value is used in expressions that do not explicitly cater to multiple
  values.  The function `values' may return multiple values, but it may
  also be used to return only one:

(values 1 2 3)
=> 1
=> 2
=> 3

  How the additional values are printed varies from implementation to
  implementation.  I prefer the above, and have programmed my Common Lisp
  system to print multiple return values that way, but your semicolon-
  separated list is just another way to do it.  E.g.,

(round 5.9)
=> 6
=> -0.09999999999999964

  Consequently,

(values (round 5.9))
=> 6

  I think it is time for you to read up on this language and not just play
  with an implementation -- this is fairly basic stuff that should have
  been covered in any reasonable tutorial material.  Which textbooks or
  other tutorials are you currently using that are confusing you?  In any
  case, I recommend the actual specification as it is quite readable and
  lets you in on the lexicon of this community, too.  Start at www.lisp.org
  and look for the HyperSpec.  Depending on your preferred learning mode, a
  standard like this may or may not be ideal for you, but familiarity with
  the authoritative reference on Common Lisp is a must sooner or later.  I
  predict you will find much joy in seeing how this language is specified.
  It is a whole different world from the mostly underspecified languagees
  that you learn by trial and error.  That, too, is a cultural difference
  that is worth appreciating.
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.