Clojure 1.8参考手册
Clojure 1.8
clojure.walk
完整名称空间名称:clojure.walk
概述
This file defines a generic tree walker for Clojure data
structures. It takes any data structure (list, vector, map, set,
seq), calls a function on every element, and uses the return value
of the function in place of the original. This makes it fairly
easy to write recursive search-and-replace functions, as shown in
the examples.
Note: "walk" supports all Clojure data structures EXCEPT maps
created with sorted-map-by. There is no (obvious) way to retrieve
the sorting function.
公共变量和函数
keywordize-keys函数
Usage: (keywordize-keys m)
Recursively transforms all map keys from strings to keywords.
在Clojure版本1.1中添加
来源
macroexpand-all函数
Usage: (macroexpand-all form)
Recursively performs all possible macroexpansions in form.
在Clojure版本1.1中添加
来源
postwalk函数
Usage: (postwalk f form)
Performs a depth-first, post-order traversal of form. Calls f on
each sub-form, uses f's return value in place of the original.
Recognizes all Clojure data structures. Consumes seqs as with doall.
在Clojure版本1.1中添加
来源
postwalk-demo功能
Usage: (postwalk-demo form)
Demonstrates the behavior of postwalk by printing each form as it is
walked. Returns form.
在Clojure版本1.1中添加
来源
postwalk-replace函数
Usage: (postwalk-replace smap form)
Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the leaves of the tree first.
在Clojure版本1.1中添加
来源
prewalk函数
Usage: (prewalk f form)
Like postwalk, but does pre-order traversal.
在Clojure版本1.1中添加
来源
prewalk-demo函数
Usage: (prewalk-demo form)
Demonstrates the behavior of prewalk by printing each form as it is
walked. Returns form.
在Clojure版本1.1中添加
来源
prewalk-replace函数
Usage: (prewalk-replace smap form)
Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the root of the tree first.
在Clojure版本1.1中添加
来源
stringify-keys函数
Usage: (stringify-keys m)
Recursively transforms all map keys from keywords to strings.
在Clojure版本1.1中添加
来源
walk函数
Usage: (walk inner outer form)
Traverses form, an arbitrary data structure. inner and outer are
functions. Applies inner to each element of form, building up a
data structure of the same type, then applies outer to the result.
Recognizes all Clojure data structures. Consumes seqs as with doall.
在Clojure版本1.1中添加
来源
Clojure 1.8相关
Clojure 是一种运行在 Java 平台上的 Lisp 方言,Lisp 是一种以表达性和功能强大著称的编程语言,但人们通常认为它不太适合应用于一般情况,而 Clojure 的出现彻底改变了这一现状。如今,在任何具备 Java 虚拟机的地方,您都可以利用 Lisp 的强大功能。
版本 | 1.8 |
发布版本 | 1.8 |