Sep. 25th, 2016

dmm: (dynosaur)
(defn rec-map-mult [scalar rec-map-of-ns]
  (if (map? rec-map-of-ns)
      (into {}
            (map #(vector (first %1)
                          (rec-map-mult scalar (second %1))
                  )
                 rec-map-of-ns
            )
      )
      (if (number? rec-map-of-ns)
          (* scalar rec-map-of-ns)
          0
      )
  )
)

user=> (rec-map-mult  3 { :a 3 :b {:c 7 :d 9} })
{:a 9, :b {:c 21, :d 27}}

Profile

dmm: (Default)
Dataflow matrix machines (by Anhinga anhinga)

December 2025

S M T W T F S
 123456
78910111213
141516 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 10th, 2026 12:38 pm
Powered by Dreamwidth Studios