Created
November 30, 2014 02:22
-
-
Save timsgardner/12c88147fd7cdeadc30a to your computer and use it in GitHub Desktop.
tensor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slacker impl of multidimensional vectors