Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Common Lisp
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Scalar types=== ''Number'' types include [[integer]]s, [[ratio]]s, [[floating-point arithmetic|floating-point number]]s, and [[complex number]]s.<ref name="reddy">{{cite web |url=http://random-state.net/features-of-common-lisp.html |title=Features of Common Lisp |first=Abhishek |last=Reddy |date=August 22, 2008 }}</ref> Common Lisp uses [[Arbitrary-precision arithmetic|bignum]]s to represent numerical values of arbitrary size and precision. The ratio type represents fractions exactly, a facility not available in many languages. Common Lisp automatically coerces numeric values among these types as appropriate. The Common Lisp ''[[character (computing)|character]]'' type is not limited to [[ASCII]] characters. Most modern implementations allow [[Unicode]] characters.<ref>{{cite web |url=http://www.cliki.net/Unicode%20Support |title=Unicode support |work=The Common Lisp Wiki |access-date=August 21, 2008 }}</ref> The ''[[Symbol (programming)|symbol]]'' type is common to Lisp languages, but largely unknown outside them. A symbol is a unique, named data object with several parts: name, value, function, property list, and package. Of these, ''value cell'' and ''function cell'' are the most important. Symbols in Lisp are often used similarly to identifiers in other languages: to hold the value of a variable; however there are many other uses. Normally, when a symbol is evaluated, its value is returned. Some symbols evaluate to themselves, for example, all symbols in the keyword package are self-evaluating. Boolean values in Common Lisp are represented by the self-evaluating symbols T and NIL. Common Lisp has namespaces for symbols, called 'packages'. A number of functions are available for [[rounding]] scalar numeric values in various ways. The function <code>round</code> rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions <code>truncate</code>, <code>floor</code>, and <code>ceiling</code> round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, <code>(floor -2.5)</code> yields β3, 0.5; <code>(ceiling -2.5)</code> yields β2, β0.5; <code>(round 2.5)</code> yields 2, 0.5; and <code>(round 3.5)</code> yields 4, β0.5.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)