Skip to content

Instantly share code, notes, and snippets.

@timsgardner
Created November 30, 2014 02:22
Show Gist options
  • Save timsgardner/12c88147fd7cdeadc30a to your computer and use it in GitHub Desktop.
Save timsgardner/12c88147fd7cdeadc30a to your computer and use it in GitHub Desktop.
tensor
(defn tensor [init dims]
(reduce #(vec (repeat %2 %1)) init (reverse dims)))
(defn tensor-2 [init [d & dims]]
(vec (repeat d (if dims (tensor-2 init dims) init))))
@timsgardner
Copy link
Author

slacker impl of multidimensional vectors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment