Back

prewalk-demo (clj)

(source)

function

(prewalk-demo form)
Demonstrates the behavior of prewalk by printing each form as it is walked. Returns form.

Examples

clojure/core.typed
(deftest keywordize-keys-test
  (is-tc-e #(keywordize-keys {"a" 1 "b" 2})
           :requires [[clojure.walk :refer [keywordize-keys]]]))

(deftest prewalk-demo-test
  (is-tc-e #(prewalk-demo [[1 2] [3 4 [5 6]] [7 8]])
           :requires [[clojure.walk :refer [prewalk-demo]]]))
typedclojure/typedclojure
(deftest keywordize-keys-test
  (is-tc-e #(keywordize-keys {"a" 1 "b" 2})
           :requires [[clojure.walk :refer [keywordize-keys]]]))

(deftest prewalk-demo-test
  (is-tc-e #(prewalk-demo [[1 2] [3 4 [5 6]] [7 8]])
           :requires [[clojure.walk :refer [prewalk-demo]]]))
retrogradeorbit/bootleg
(ns bootleg.namespaces
  (:require [bootleg.utils :as utils]
            [bootleg.enlive :as enlive]
            [bootleg.selmer :as selmer]
            [bootleg.markdown :as markdown]
            [bootleg.mustache :as mustache]
            [bootleg.asciidoc :as asciidoc]
            [bootleg.html :as html]
            [bootleg.yaml :as yaml]
            [bootleg.json :as json]
            [bootleg.edn :as edn]
            [bootleg.glob :as glob]
            [bootleg.file :as file]
            [bootleg.minify :as minify]
            [hickory.convert]
            [hickory.hiccup-utils]
            [hickory.render]
            [hickory.select]
            [hickory.utils]
            [hickory.zip]
            [net.cgrand.enlive-html :as enlive-html]
            [net.cgrand.jsoup]
            [net.cgrand.reload]
            [net.cgrand.tagsoup]
            [net.cgrand.xml]
            [selmer.filter-parser]
            [selmer.filters]
            [selmer.middleware]
            [selmer.node]
            [selmer.parser]
            [selmer.tags]
            [selmer.template-parser]
            [selmer.util]
            [selmer.validator]
            [edamame.core :refer [parse-string]]
            [sci.core :as sci]
            [clojure.walk]
            [clojure.zip]
            [clojure.tools.cli]
            ))

   'clojure.walk {
                  'walk clojure.walk/walk
                  'postwalk clojure.walk/postwalk
                  'prewalk clojure.walk/prewalk
                  'postwalk-demo clojure.walk/postwalk-demo
                  'prewalk-demo clojure.walk/prewalk-demo
                  'keywordize-keys clojure.walk/keywordize-keys
                  'stringify-keys clojure.walk/stringify-keys
                  'prewalk-replace clojure.walk/prewalk-replace
                  'postwalk-replace clojure.walk/postwalk-replace
                  }
reborg/clojure-essential-reference
(require '[clojure.walk :refer [prewalk-demo postwalk-demo]])

(prewalk-demo [1 [2 [3]] 4]) ; <1>
;; Walked: [1 [2 [3]] 4]
;; Walked: 1
;; Walked: [2 [3]]
;; Walked: 2
;; Walked: [3]
;; Walked: 3
;; Walked: 4
;; [1 [2 [3]] 4]
thi-ng/demos
(ns ex03.walker
  (:require
   [clojure.xml :as xml]
   [clojure.walk :as walk :refer [prewalk]]))

(postwalk-demo data)
(prewalk-demo data)