📅  最后修改于: 2020-11-05 04:05:49             🧑  作者: Mango
StructMaps用于在Clojure中创建结构。例如,如果您想创建一个由Employee Name和Employeeid组成的结构,则可以使用StructMaps完成。
关于ClouctMap,在Clojure中可以进行以下操作。
Sr.No. | Operations & Description |
---|---|
1 | defstruct
This function is used for defining the structure which is required. |
2 | struct
This function is used to define a structure object of the type, which is created by the defstruct operation. |
3 | struct-map
This function is used to specifically assign values to key values by explicitly defining which values get assigned to which keys in the structure. |
4 | Accessing Individual Fields
Individual fields of the structure can be accessed by accessing the keys along with the structure object. |
5 | Immutable Nature
By default structures are also immutable, so if we try to change the value of a particular key, it will not change. |
6 | Adding a New Key to the Structure
Since structures are immutable, the only way that another key can be added to the structure is via the creation of a new structure. An example on how this can be achieved is shown in the following program. |