Movatterモバイル変換


[0]ホーム

URL:


Clojure

Clojure Core API Reference

Clojurev1.13.0 API
Namespaces
Other Versions
Clojure Home

API forclojure.walk -Clojurev1.13.0 (in development)

byStuart Sierra

Full namespace name:clojure.walk

Overview

This file defines a generic tree walker for Clojure datastructures.  It takes any data structure (list, vector, map, set,seq), calls a function on every element, and uses the return valueof the function in place of the original.  This makes it fairlyeasy to write recursive search-and-replace functions, as shown inthe examples.Note: "walk" supports all Clojure data structures EXCEPT mapscreated with sorted-map-by.  There is no (obvious) way to retrievethe sorting function.

Public Variables and Functions



keywordize-keys

function
Usage: (keywordize-keys m)
Recursively transforms all map keys from strings to keywords.
Added in Clojure version 1.1
Source


macroexpand-all

function
Usage: (macroexpand-all form)
Recursively performs all possible macroexpansions in form.
Added in Clojure version 1.1
Source


postwalk

function
Usage: (postwalk f form)
Performs a depth-first, post-order traversal of form.  Calls f oneach sub-form, uses f's return value in place of the original.Recognizes all Clojure data structures. Consumes seqs as with doall.
Added in Clojure version 1.1
Source


postwalk-demo

function
Usage: (postwalk-demo form)
Demonstrates the behavior of postwalk by printing each form as it iswalked.  Returns form.
Added in Clojure version 1.1
Source


postwalk-replace

function
Usage: (postwalk-replace smap form)
Recursively transforms form by replacing keys in smap with theirvalues.  Like clojure/replace but works on any data structure.  Doesreplacement at the leaves of the tree first.
Added in Clojure version 1.1
Source


prewalk

function
Usage: (prewalk f form)
Like postwalk, but does pre-order traversal.
Added in Clojure version 1.1
Source


prewalk-demo

function
Usage: (prewalk-demo form)
Demonstrates the behavior of prewalk by printing each form as it iswalked.  Returns form.
Added in Clojure version 1.1
Source


prewalk-replace

function
Usage: (prewalk-replace smap form)
Recursively transforms form by replacing keys in smap with theirvalues.  Like clojure/replace but works on any data structure.  Doesreplacement at the root of the tree first.
Added in Clojure version 1.1
Source


stringify-keys

function
Usage: (stringify-keys m)
Recursively transforms all map keys from keywords to strings.
Added in Clojure version 1.1
Source


walk

function
Usage: (walk inner outer form)
Traverses form, an arbitrary data structure.  inner and outer arefunctions.  Applies inner to each element of form, building up adata structure of the same type, then applies outer to the result.Recognizes all Clojure data structures. Consumes seqs as with doall.
Added in Clojure version 1.1
Source
Copyright 2007-2025 by Rich Hickey
Logo & site design byTom Hickey.
Clojure auto-documentation system by Tom Faulhaber.

[8]ページ先頭

©2009-2025 Movatter.jp