{"id":825,"date":"2017-09-23T22:19:20","date_gmt":"2017-09-23T20:19:20","guid":{"rendered":"http:\/\/www.rocworks.at\/wordpress\/?p=825"},"modified":"2017-09-23T22:19:20","modified_gmt":"2017-09-23T20:19:20","slug":"matrix-multiplication-in-clojure","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=825","title":{"rendered":"Matrix Multiplication in Clojure&#8230;"},"content":{"rendered":"<p>Clojure code for matrix multiplication (source: <a href=\"https:\/\/rosettacode.org\/wiki\/Matrix_multiplication#Clojure\">Rosetta Code<\/a>) &#8230; short &amp; smart&#8230;<\/p>\n<pre>(def mmul (fn [a b]\r\n  (let [nested-for (fn [f x y] (map (fn [a] (map (fn [b] (f a b)) y)) x))\r\n        transpose (fn [m] (apply map vector m))]\r\n    (nested-for (fn [x y] (reduce + (map * x y))) a (transpose b)))))\r\n\r\n(def ma [[1 2 3 4]\r\n         [4 3 2 1]])\r\n\r\n(def mb [[1]\r\n         [2]\r\n         [3]\r\n         [4]])\r\n\r\n(defn -main [&amp; args]\r\n  (println (mmul ma mb)))<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Clojure code for matrix multiplication (source: Rosetta Code) &#8230; short &amp; smart&#8230; (def mmul (fn [a b] (let [nested-for (fn [f x y] (map (fn [a] (map (fn [b] (f a b)) y)) x)) transpose (fn [m] (apply map vector m))] (nested-for (fn [x y] (reduce + (map * x y))) a (transpose b))))) (def &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=825\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Matrix Multiplication in Clojure&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-825","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=825"}],"version-history":[{"count":1,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/825\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/825\/revisions\/826"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}