Clojure language 1: Symbol

Source: Internet
Author: User

Symbol writing method:

1. It cannot start with a number.

2. It can be followed by text or numbers and *, + ,!, -,_,?

3./is a special character. It can only appear once in symbol. Generally, namespace is on the left. For example, my-namespace/Foo.

4 .. It is also a special character and can appear in symbol multiple times. For example, java. util. bitset.

5.: It can be used in symbol multiple times, but it cannot be continuous.

6. the symbol at the beginning or end is the symbol used by clojure itself. The symbol at the beginning or end is also the symbol used by clojure itself.


Clojure is a little different from general lisp, and there are the following differences in symbol:

1. Nil is not a symbol

2. the keyword (keyword) is not a symbol.

3. Unlike var, symbol is not a storage location.

For var reference my post: http://blog.csdn.net/sheismylife/article/details/8445916


As a basic description of the lisp language, other symbol can be found in another article:

Http://blog.csdn.net/sheismylife/article/details/7466413


You can use def to define a symbol, for example:

User => (def x 5) # 'user/x

The value of symbol X is 5, and the namespace is user.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.