make it work under cljs

I figured that it was a problem of `clj->js`. To be honest, I would love to rework those stacks into clojure transients, but it's a bit too late and I didn't figure out how to run all expansions. Maybe `lazy-seq` would help there... Anyway, those changes make it work under CLJS. I figured that having separate `index-of` is better than trying to figure out than converting all paths into javascript arrays. :)
This seems weird. I was checking for -1 before, where is that in the new code? Wouldn't the if case be hit by index-of returning 0?