1.3.0 permalink Arrow_down_16x16

prewalk-demo

clojure.walk

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

1 Example top

  • (use 'clojure.walk)
    
    user> (prewalk-demo [[1 2] [3 4 [5 6]] [7 8]])
    Walked: [[1 2] [3 4 [5 6]] [7 8]]
    Walked: [1 2]
    Walked: 1
    Walked: 2
    Walked: [3 4 [5 6]]
    Walked: 3
    Walked: 4
    Walked: [5 6]
    Walked: 5
    Walked: 6
    Walked: [7 8]
    Walked: 7
    Walked: 8
    [[1 2] [3 4 [5 6]] [7 8]]
    
    user> (prewalk-demo {:a 1 :b 2})
    Walked: {:a 1, :b 2}
    Walked: [:a 1]
    Walked: :a
    Walked: 1
    Walked: [:b 2]
    Walked: :b
    Walked: 2
    {:a 1, :b 2}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/walk.clj:84 top

(defn prewalk-demo
  "Demonstrates the behavior of prewalk by printing each form as it is
  walked.  Returns form."
  {:added "1.1"}
  [form]
  (prewalk (fn [x] (print "Walked: ") (prn x) x) form))
Vars in clojure.walk/prewalk-demo:
Used in 0 other vars

Comments top

No comments for prewalk-demo. Log in to add a comment.