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
Lisp (programming language)
(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!
===Lists=== A Lisp list is written with its elements separated by [[Whitespace character|whitespace]], and surrounded by parentheses. For example, {{Lisp2|(1 2 foo)}} is a list whose elements are the three ''atoms'' {{Lisp2|1}}, {{Lisp2|2}}, and [[foo|{{#tag:syntaxhighlight|foo|lang=Lisp|inline=1}}]]. These values are implicitly typed: they are respectively two integers and a Lisp-specific data type called a "symbol", and do not have to be declared as such. The empty list {{Lisp2|()}} is also represented as the special atom {{Lisp2|nil}}. This is the only entity in Lisp which is both an atom and a list. Expressions are written as lists, using [[Polish notation|prefix notation]]. The first element in the list is the name of a function, the name of a macro, a lambda expression or the name of a "special operator" (see below). The remainder of the list are the arguments. For example, the function {{Lisp2|list}} returns its arguments as a list, so the expression <syntaxhighlight lang="Lisp"> (list 1 2 (quote foo)) </syntaxhighlight> evaluates to the list {{Lisp2|(1 2 foo)}}. The "quote" before the {{Lisp2|foo}} in the preceding example is a "special operator" which returns its argument without evaluating it. Any unquoted expressions are recursively evaluated before the enclosing expression is evaluated. For example, <syntaxhighlight lang="Lisp"> (list 1 2 (list 3 4)) </syntaxhighlight> evaluates to the list {{Lisp2|(1 2 (3 4))}}. The third argument is a list; lists can be nested.
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)