Re: constructing matrix-like structures with list-comprehension

2013-02-06 Thread Jim - FooBar();
Hi Mike, thanks for your reply...I've actually been keeping a very close eye on core.matrix since day 1 and I have to admit I am very very tempted to start contributing...My research is on Text-mining which as you probably know is machine-learning on text (mainly sequence-labelling, HMM based

Re: constructing matrix-like structures with list-comprehension

2013-02-06 Thread Mikera
Hmmm... sounds like you might want to take a look at the latest development version core.matrix: https://github.com/clojure-numerics/core.matrix You can construct nested vectors of arbitrary shape, e.g. (new-array 2 3 4 5) This creates a new 4-dimensional 2x3x4x5 matrix. core.matrix supports

Re: constructing matrix-like structures with list-comprehension

2013-02-05 Thread Jim - FooBar();
Ok, I think I cracked it but as usual someone else might come up with a cleaner approach...:-) (defn matrix [dim & dim-lengths] {:pre [(not (nil? dim))]} ;;cannot accept (let [bindings (map #(vector (gensym) `(range ~%)) dim-lengths) symbols (mapv first bindings) counts (inc (coun

Re: constructing matrix-like structures with list-comprehension

2013-02-05 Thread Jim foo.bar
I do hate writing code on thunderbird!!! '(< counts 1)' should obviously be '(> ~counts 1)'... Jim On 05/02/13 15:03, Jim foo.bar wrote: Hi all, I 'm a bit confused with this - I'm trying to think but I can't!!! Probably cos I've not had any food yet! Up till now I thought I could constru

constructing matrix-like structures with list-comprehension

2013-02-05 Thread Jim foo.bar
Hi all, I 'm a bit confused with this - I'm trying to think but I can't!!! Probably cos I've not had any food yet! Up till now I thought I could construct matrices with 'for'...So (for [i (range 3)] i) gives us a 1d structure (a list)... (for [i (range 3) j (range 4)] [i j]) gives us a 2d struc