small medium large xlarge

Back to: All Forums  PragPub
Generic-user-small
06 Jul 2011, 18:56
Joseph Jones (1 post)

In the first code listing, I believe that ‘a’ should br replaced with ‘w’ for the 3 let bindings after the w binding.

i.e.

(defn list-ex [] (let [w ‘(1 2 3) ; Figure 1 x (rest a) ; Figure 2 y (conj a ‘(3 4)) ; Figure 3 z (cons 1 a) ; Figure 4 …

should be

(defn list-ex [] (let [w ‘(1 2 3) ; Figure 1 x (rest w) ; Figure 2 y (conj w ‘(3 4)) ; Figure 3 z (cons 1 w) ; Figure 4 …

Generic-user-small
07 Jul 2011, 00:53
Steven Reynolds (2 posts)

Joseph

You are entirely right, sorry that typo slipped through.

Steven Reynolds

Generic-user-small
05 Aug 2011, 14:43
Steven Reynolds (2 posts)

The corrected code should read like follows

(defn list-ex []
  (let [w '(1 2 3)
        x (rest w)
        y (conj  w '(3 4))
        z (cons 1 w)
        lsaver (PersistentListSaver.)
        csaver (ConsSaver.)]
    (. lsaver save w "list_before.dot")
    (. lsaver save x "list_after_rest.dot")
    (. lsaver save y "list_after_conj.dot")
    (. csaver save z "list_after_cons.dot")
    ))
Generic-user-small
17 Jan 2012, 03:42
Michael Peterson (1 post)

Hi, Thanks for this article. Any chance you have (or would) release the PersistentListSaver/ConsSaver type code? I’d be interested in how you did that and integrated with GraphViz.

Thanks so much, Michael

You must be logged in to comment