Question

In trying to use the draw-tree function from vijual I have run into some issues. First, I'm unsure if I am using the right namespace(:require vijual :reload), since I have not been able to draw any trees. I have also tried (:require vijual.graphical) but that was not recognized. This has led to draw-tree not being recognized, i.e. CompilerException Unable to resolve symbol.

The nodes of the trees should correspond to n-tuples and in the case below 3-tuples. The inputs have looked like

(def foo (draw-tree [[:vec (9/2 6 13/2) [[[:vec (1 2 3)] [:vec (2 3 4)]] [:vec (3 4 5)]] [:vec (7 9 9)]]]))

which corresponds to the tree

{:vec (9/2 6 13/2)
 :right {:vec [7 9 9]},
 :left  {:right {:vec [3 4 5]}, 
         :left  {:vec [1 2 3]}, 
         :vec (2 3 4)}}

The dependency I have been using is [org.clojars.overtone/vijual "0.2.1"].

Was it helpful?

Solution

If you are at a repl, this should work:

(use 'vijual)
(def foo (draw-tree ....

use refers another namespaces symbols into your current namespace so you can call them without qualifying them. require loads the namespace but would require you to reference symbols with it:

(require 'vijual)
(def foo (vijual/draw-tree ...

When I did this the function was invoked, but still had errors. In particular, you have (9/2 6 13/2) etc - this will attempt to invoke 9/2 as a function. I don't quite understand exactly what you are shooting for (in particular with the map) but this does a start of something:

(def foo (draw-tree [[:vec [9/2] [6] [13/2]] ]))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top